[Gambas-user] ColumnView: how to add text to columns (Gambas 2)
Anthony Tekatch
anthony at ...2542...
Tue Feb 22 17:51:49 CET 2011
> ... how to insert text into other columns than column 0.
>
> ColumnView1.Add("key1", "Text1") only adds text to the leftmost column,
> the one that can be shown like a treeview. (I don't need that treeview
> feature, just several columns.) And how do I add text to column 1, 2
> etc.?
Here is an example. I am using a ColumnView called ProductsList
In the Form_Open do, I do this:
ProductsList.Columns.Count = 4
ProductsList.Header = 1 'show header
ProductsList.Mode = Select.Single
ProductsList.Columns[0].Text = "ID"
ProductsList.Columns[1].Text = "Act"
ProductsList.Columns[2].Text = "Des"
ProductsList.Columns[3].Text = "Description"
The to populate the entire Columnview, here is part of the code used:
...
ctr = 1
FOR EACH Result
ProductsList.Add(ctr, Result!product_id)
ProductsList[ctr][1] = Result!actual_stock
ProductsList[ctr][2] = Result!desired_stock
ProductsList[ctr][3] = Result!description
INC ctr
IF ctr > 1000 THEN BREAK
NEXT
...
So as you can see, your "Add" adds an entire row. The you can use array
identifiers to address and set the column values. Probably like this:
ColumnView1["key1"][1] = "Text A"
ColumnView1["key1"][2] = "Text B"
More information about the User
mailing list