How does one get columns into a FireMonkey TListBox and then get the values out of the columns for the rows a TListBox. I am using this approach:
vListRow := 'Col1Stuff' + '^I' + 'Col2Stuff';
This is NOT giving me Col1Stuff in the 1st column and Col2Stuff in the 2nd Column.
I tried the TStringGrid Firemonkey control as an alternative, but the following approach is not working either:
vStringGrid.Cells[0,1] := 'Hi'; vStringGrid.Cells[0,2] := 'There';
This puts nothing in the TStringGrid.
Any tips?
For the
TListBox
, use a tab character (#9):To get the values out, you'd have to parse them back out, using the tab character as the delimiter (separator). It's usually more efficient and readable to use the ItemIndex instead, however.
Since you're doing direct concatenation, you can even omit the '+' (but you have to also remove the leading and trailing space:
For the
TStringGrid
, use the Items Editor to add twoTStringColumns
to the grid. You can then access theCells
property to read/write values - note thatCells
are referenced by [column, row] values: