[Gambas-user] Questions about SQLIte and Data Objects

Benoît Minisini gambas at ...1...
Mon Aug 20 20:13:05 CEST 2012


Le 10/08/2012 01:34, acidblue a écrit :
>
> I noticed when i use 'datetime' as a type in sqlite it also adds a time at
> the end the date:
> 8/9/2012 00:00:00 when displayed in a dataview box.
>
> Is there a way to NOT display the time, just the date?

I think I have some sort of solution for you, in revision #5059:

DataView now raises a "Data" event, exactly like the GridView control, 
except that the Data event handler receives three arguments: the row, 
the column and the database value.

In that event handler, you will be able to define the cell visual 
contents through the new DataView.Data property (exactly like GridView).

So, to not display the time part of the date:

Public Sub MyDataView_Data(Row As Integer, Column As Integer, Value As 
Variant)

   ' Let's suppose that the date is in the third column.
   If Column = 2 Then MyDataView.Data.Text = Format(Value, gb.ShortDate)

   ' By default, the other columns will be displayed the old way.

End

>
> I have to re-adjust the column widths every time program loads,(using
> dataview),this is inherited
> of the length of the Varchar and string elements in the database.
> Is there a way to adjust the column widths to my liking and have them stay
> that way?

I think so, as the DataView.View property will return its underlying 
TableView for you. That way, you can redefine the width of each 
TableView column as you like.

Maybe I should add a "Load" event that would be raised each time the 
DataView contents has been loaded from the database. That way, you won't 
have to worry about when exactly you should apply the columns widths...

>
> I've tried using both the datacombo and the datacomboview but have received
> error messages when I do.
> "Unknown symbol in HeaderHieght in class", Grid_viewRows"
> But when I double click either the datacomdo or the comboview to enter code
> gambas crashes.
>

Please provide the details: exact error messages, little project example...

-- 
Benoît Minisini




More information about the User mailing list