5133p39 16 Posted June 1, 2008 I have a dialog with listbox. I fill the listbox with items, and then i want to sort it. lbSort seems like the only choice, but it needs a control to work with. How do i get the "control" when the dialog is opened by createDialog and i am able to access the listBox only by its IDC? I spent several hours to find a way to get the "control", or to open the dialog using the createDisplay command (which would then provide me with a way to get the "control"), but i have achieved nothing (didn't even found a way to use the createDialog command). What am i missing? Share this post Link to post Share on other sites
i0n0s 0 Posted June 1, 2008 <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">private ["_display", "_ctrl"] _display = findDisplay IDD _ctrl = _display displayctrl IDC Share this post Link to post Share on other sites
5133p39 16 Posted June 1, 2008 Thanks, it showed me little thing that i missed - during the process of making it work, i had some problem with the IDD of my dialog, so i set it to -1 because it led me to think that IDD works only for "displays" and not "dialogs", which was wrong. Thank you very much, i only wish i had the nerve to ask right away, it would save me all night :-). For anyone confused as i was, here is how:<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_d = createDialog "myDisplayWithListbox"; _idx = lbAdd [IDC_OF_THE_LISTBOX, "i was stupid"]; lbSetData [IDC_OF_THE_LISTBOX, _idx, "fool"]; _idx = lbAdd [IDC_OF_THE_LISTBOX, "and now i know"]; lbSetData [IDC_OF_THE_LISTBOX, _idx, "smart"]; lbSort ((findDisplay IDD_OF_MY_DISPLAY) displayCtrl IDC_OF_THE_LISTBOX); ...and now the listbox items are ordered by their text values like this: 1. "and now i know" 2. "i was stupid" Share this post Link to post Share on other sites