Jump to content
Sign in to follow this  
5133p39

lbSort - works only with "control"?

Recommended Posts

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

<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

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

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×