Dynamic ColumnInfo

3 posts / 0 new
Last post
mritter0
mritter0's picture
Offline
Last seen: 2 years 6 months ago
Joined: 2014-04-21 21:15
Dynamic ColumnInfo

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:

  1. SelectByTypeChooserList=ChooserLabels(NULL);
  2. ChooserNode=IChooser->AllocChooserNode(
  3. CNA_Text, SAK_LocaleString(MSG_DT_SYSTEM),
  4. TAG_DONE);
  5. SAK_AddChooserNode(SelectByTypeChooserList,ChooserNode,GLIST_BOTTOM);
  6. ChooserNode=IChooser->AllocChooserNode(
  7. CNA_Text, SAK_LocaleString(MSG_DT_TEXT),
  8. TAG_DONE);
  9. SAK_AddChooserNode(SelectByTypeChooserList,ChooserNode,GLIST_BOTTOM);
  10. ChooserNode=IChooser->AllocChooserNode(
  11. CNA_Text, SAK_LocaleString(MSG_DT_DOCUMENT),
  12. TAG_DONE);
  13. SAK_AddChooserNode(SelectByTypeChooserList,ChooserNode,GLIST_BOTTOM);
thomas
thomas's picture
Offline
Last seen: 1 week 23 hours ago
Joined: 2011-05-16 14:23
Re: Dynamic ColumnInfo

Create your own list of columns in a loop and after the loop count nodes and compose a tag list for AllocLBColumnInfoA.

mritter0
mritter0's picture
Offline
Last seen: 2 years 6 months ago
Joined: 2014-04-21 21:15
Re: Dynamic ColumnInfo

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).

Log in or register to post comments