Hi, There,
In my application, I would like to implement a function which only allow users to select single row from a list box. The list box was implemented with String List. I found it would be quite involved if I coded myself:
1. The user selects a row with data button.
2. Search if there is already a row selected.
3. Unselect the "old selected row".
4. Select the new row.
I think that this may be a quite common requirement in list box row selection. I am just wondering f there is Is there a built-in MDL function to achieve this?
Any suggestion will be greatly appreciated.
Ken
Here's an example ListBox resource definition from a .r file …
#include <dlogbox.h> #include <rscdefs.h> DItem_ListBoxRsc LISTBOXID_Symboliser = { NOHELP, MHELP, HOOKITEMID_ListBox, NOARG, LISTATTR_DYNAMICSCROLL | LISTATTR_NOSELECTION | LISTATTR_GRID | LISTATTR_INDEPENDENTCOLS | LISTATTR_RESIZABLECOLUMNS | LISTATTR_HORIZSCROLLBAR | LISTATTR_EDITABLE | LISTATTR_DRAWPREFIXICON, 6, 0, "", { {26*XC, DescrLength, ALIGN_LEFT, lbCol_Purpose }, { 8*XC, 8, ALIGN_LEFT, lbCol_Colour }, { 8*XC, 8, ALIGN_LEFT, lbCol_FillColour }, } };
The LISTATTR_XXX macros are #defined in dlogbox.h. Macro LISTATTR_SELSINGLE is probably what you are looking for.
These attributes define how the ListBox resource is compiled (by rcomp.exe). It matters not whether the ListBox data are stored in a StringList or ListModel.
Regards, Jon Summers LA Solutions
Hi, Jon,
Thanks for the reply. As usually, you are the one to rescue the troubled MDL programmers.
Best Regards,