list box help

Status
Not open for further replies.

bond

Usenet Archive
Joined
Jul 6, 2001
Messages
24
Reaction score
0
After the dialog opens for the first time, and the StringList is set for the listbox, is it possible to destroy the StringList and create a new one, while the dialog is still open. I want to do this in order to change the StringList based on a selected item in a combobox.

Thanks.
 
Absolutely. Here is an exerpt from MySteel.ma, which is an extension of steel.ma. This code comes from an option button hook function. When the option button is changed, the listbox is cleared, the stringlist repopulated, then the listbox refreshed.

/* --- set global variable to list box raw item header --- */ diP = mdlDialog_itemGetByTypeAndId (dimP->db, RTYPE_ListBox, LISTBOXID_SectionList, 0); sectionRiP = diP->rawItemP;

/* --- get pointer to string list to free --- */ stringListP = mdlDialog_listBoxGetStrListP (sectionRiP); if (stringListP) { mdlStringList_destroy (stringListP); stringListP = NULL; }

/* --- repopulate master stringlist --- */
stringListP = mdlStringList_create (0, SECTION_INFO_FIELDS); steel_loadSectionStringList (stringListP);

/* --- set list box to display string list for sections --- */ mdlDialog_listBoxSetStrListP (sectionRiP, stringListP, SECTION_COLUMNS);

mdlDialog_listBoxSetTopRowRedraw (sectionRiP, 0, TRUE); mdlDialog_listBoxSelectCells (sectionRiP, 0, 0, 0, 0, TRUE, TRUE);

Hope this helps...
 
Certainly you can.
After you create a new StringList, please set it to dialog listbox again.

Foo.
 
Status
Not open for further replies.

Latest threads

Back
Top