Home » U++ Library support » ArrayCtrl, HeaderCtrl & GridCtrl » How to get edit data in virtual ArrayCtrl?
How to get edit data in virtual ArrayCtrl? [message #9797] |
Wed, 30 May 2007 23:21 |
|
Hi,
I have a problem with ArrayCtrl with virtual data.
Background:
I'm trying to make a little utility for translation of texts for an embedded display solution I have.
It's a proprietary display, with a lousy SDK, but I have been able to change the drawing routine to accept additional characters. I have then made some new fonts with extra characters for german, danish and polish languages. The standard display supports ASCCI chars from 0x21 to 0x7F, and I simply added the needed characters on top of that.
My translation utility should now take an array of unicode strings and export it C source files with C style strings where the extended characters are exchanged with /x00 values.
Problem:
Since it's a translation utility I need to be able to add and remove column as I please, and neither ArrayCtrl or GridCtrl seems to be able to do that. GridCtrl can remove columns, but it seems I can only add columns before I add row data.
So I made a GridData class holding all my text data, and gave it all the functions I needed. Now using the virtual mode of ArrayCtrl I'm able to display data from my data pool with the following function:
Array<EditString> edits;
Array<VirtualField> fields;
GridData map;
....
void CANtrakTexts::PopulateGrid()
{
text_grid.Reset();
edits.Clear();
fields.Clear();
for (int i=0 ; i < map.GetColumnCount() ; i++)
{
text_grid.AddRowNumColumn(map.GetColumn(i), 180).Edit(edits.Add()).SetConvert(fields.Add(new VirtualField(i, &map)));
}
text_grid.SetVirtualCount(map.GetRowCount());
}
The problem is that when I edit the contents of a row and tries to intercept it in the WhenAcceptEdit callback, I have no idea where to find my submitted data:
void CANtrakTexts::OnAcceptEdit()
{
String str;
for (int i=0 ; i < text_grid.GetColumnCount() ; i++)
{
// The ReadRow function returns nothing...
// map.SetRow(i, text_grid.ReadRow(text_grid.GetClickRow()));
// The edits all returns 0...
map.Set(i, text_grid.GetClickRow(), edits[i].GetData());
}
}
Could someone please tell me if it's possible and how?
Thank you in advance,
Steffen
|
|
|
Goto Forum:
Current Time: Tue May 14 05:32:51 CEST 2024
Total time taken to generate the page: 0.02027 seconds
|