Home » U++ Library support » ArrayCtrl, HeaderCtrl & GridCtrl » Date pasted in GridCtrl saved in sqlite. Problem and solution
Re: Date pasted in GridCtrl saved in sqlite. Problem and solution [message #17841 is a reply to message #17838] |
Sat, 30 August 2008 21:22   |
|
koldo wrote on Sat, 30 August 2008 09:14 | Hello amrein
I do not know if calling it a bug, but perhaps it is an improvement.
When you add a column, for example:
myGrid.AddColumn(BIRTHDAY, t_("Birthday")).Edit(birthdate);
GridCtrl does not know the type, so it can only manage the data as Value(String).
Perhaps it would be possible to do a kind of SQLGridCtrl class that:
- You could include the database table, so it would know about the type of every column
- It would include inside the functions LoadTable, InsertRow, UpdateRow and RemoveRow.
Well, a little soon for me and perhaps it is a thing that unodgs has to decide.
Best regards
|
I have added WhenPasteCell<int row, int col, Value& v> callback. It's called when you paste data from clipboard. If you create your own method and assign it to this callback you will be able to return back the correct value (with correct type). In Excel scenario that means Value(String) will be passed to the callback method. Now you know what type of column number "col" is and you know how to convert String to this value. Maybe better will be example :
void MyConventer(int row, int col, Value& v)
{
if(col == 0) //int
{
v = StrToInt(v);
}
else if(col = 10)
{
v = DblToInt(v);
}
}
grid.WhenPasteCell = THISBACK(MyConventer);
I think this will help in your "clipboard problem"
Regarding SqlGridCtrl. It's a good idea but it will be part of GridCtrl 2.0. Generaly 2.0 will be much more sql related (of course I'll try to do my best to save backward compatibility).
|
|
|
Goto Forum:
Current Time: Fri Jul 18 07:30:12 CEST 2025
Total time taken to generate the page: 0.03981 seconds
|