I have a need to create a dynamic ColumnInfo for a listbrowser. I want to be able to add nodes in a loop like you would when adding to the listbrowser's items. The number of columns may vary. The order may vary, which is the biggest need for dynamic creation.
create AllocLBColumnInfo() without specifying number of columns (or anything)
create a new list
for(;;)
{
allocate a new node
fill in details
add to list
}
attach list to ColumnInfo
attach ColumnInfo to listbrowser
Similar to how a Chooser list is created, too:
SelectByTypeChooserList=ChooserLabels(NULL); ChooserNode=IChooser->AllocChooserNode( CNA_Text, SAK_LocaleString(MSG_DT_SYSTEM), TAG_DONE); SAK_AddChooserNode(SelectByTypeChooserList,ChooserNode,GLIST_BOTTOM); ChooserNode=IChooser->AllocChooserNode( CNA_Text, SAK_LocaleString(MSG_DT_TEXT), TAG_DONE); SAK_AddChooserNode(SelectByTypeChooserList,ChooserNode,GLIST_BOTTOM); ChooserNode=IChooser->AllocChooserNode( CNA_Text, SAK_LocaleString(MSG_DT_DOCUMENT), TAG_DONE); SAK_AddChooserNode(SelectByTypeChooserList,ChooserNode,GLIST_BOTTOM);
Create your own list of columns in a loop and after the loop count nodes and compose a tag list for AllocLBColumnInfoA.
I came up with:
Count how many columns will be displayed.
AllocLBColumnInfo(num) with an always stationary column filled in.
Do my loop and use SetLBColumnInfoAttrs() and fill in each column's info.
Then when start to fill in items:
AllocListBrowserNode(num) with 2 global tags.
Do my loop and use SetListBrowserNodeAttrs(node) to fill each column's data.
I was hiding columns by setting width to 0, but the drag bar was not hidden so was getting thick (several next to each other).