scrollable_20list_20boxes
Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
scrollable_20list_20boxes [2018/03/31 13:19] – external edit 127.0.0.1 | scrollable_20list_20boxes [2024/01/05 00:21] (current) – external edit 127.0.0.1 | ||
---|---|---|---|
Line 7: | Line 7: | ||
- If the longest item will not fit across the width of the list box, it is possible to arrange for a horizontal scroll bar to be added. However, this requires extra code (see below). | - If the longest item will not fit across the width of the list box, it is possible to arrange for a horizontal scroll bar to be added. However, this requires extra code (see below). | ||
\\ Items 1 and 2 are covered in the main [[http:// | \\ Items 1 and 2 are covered in the main [[http:// | ||
+ | <code bb4w> | ||
WS_HSCROLL = &100000 | WS_HSCROLL = &100000 | ||
PROC_listbox(dlg%, | PROC_listbox(dlg%, | ||
+ | </ | ||
Similarly, when creating the list box on the output window include the value in the final parameter of **FN_listbox**, | Similarly, when creating the list box on the output window include the value in the final parameter of **FN_listbox**, | ||
+ | <code bb4w> | ||
WS_HSCROLL = &100000 | WS_HSCROLL = &100000 | ||
hlb% = FN_listbox("", | hlb% = FN_listbox("", | ||
+ | </ | ||
The **WS_HSCROLL** style may be combined with any others required, but the code listed here is //__not__// compatible with the **LBS_USETABSTOPS** or **LBS_MULTICOLUMN** styles.\\ \\ Once created (and, in the case of a dialogue box, displayed) the listbox may be populated with string items. Instead of sending the usual LB_ADDSTRING message, call the **PROC_addstring** routine, which enables correct behaviour of the horizontal scroll bar. In the case of a dialogue box it is first necessary to discover the handle of the list box as follows: | The **WS_HSCROLL** style may be combined with any others required, but the code listed here is //__not__// compatible with the **LBS_USETABSTOPS** or **LBS_MULTICOLUMN** styles.\\ \\ Once created (and, in the case of a dialogue box, displayed) the listbox may be populated with string items. Instead of sending the usual LB_ADDSTRING message, call the **PROC_addstring** routine, which enables correct behaviour of the horizontal scroll bar. In the case of a dialogue box it is first necessary to discover the handle of the list box as follows: | ||
+ | <code bb4w> | ||
SYS " | SYS " | ||
+ | </ | ||
Where **dlg%** is the value returned from **FN_newdialog** and **id%** is the ID number of the list box. In the case of a list box on the main output window, the handle is returned from **FN_listbox** as shown above.\\ \\ In either case, to populate the listbox use code similar to the following: | Where **dlg%** is the value returned from **FN_newdialog** and **id%** is the ID number of the list box. In the case of a list box on the main output window, the handle is returned from **FN_listbox** as shown above.\\ \\ In either case, to populate the listbox use code similar to the following: | ||
+ | <code bb4w> | ||
PROC_addstring(hlb%, | PROC_addstring(hlb%, | ||
PROC_addstring(hlb%, | PROC_addstring(hlb%, | ||
REM etc. | REM etc. | ||
+ | </ | ||
You can, of course, add the items within a loop if more convenient.\\ \\ To delete an item from a list box, call the **PROC_delstring** routine instead of sending the LB_DELETESTRING message: | You can, of course, add the items within a loop if more convenient.\\ \\ To delete an item from a list box, call the **PROC_delstring** routine instead of sending the LB_DELETESTRING message: | ||
+ | <code bb4w> | ||
PROC_delstring(hlb%, | PROC_delstring(hlb%, | ||
+ | </ | ||
where **index%** is the index number (starting at zero) of the item you wish to delete. If that item was longer than the others, the horizontal scroll bar will be adjusted (or removed) accordingly. Note that, by default, the items in a list box created using **PROC_listbox** are sorted into alphabetical order; therefore the index numbers of the items typically won't correspond to the order in which they were added. If necessary use the **LB_FINDSTRING** or **LB_FINDSTRINGEXACT** message to discover a string' | where **index%** is the index number (starting at zero) of the item you wish to delete. If that item was longer than the others, the horizontal scroll bar will be adjusted (or removed) accordingly. Note that, by default, the items in a list box created using **PROC_listbox** are sorted into alphabetical order; therefore the index numbers of the items typically won't correspond to the order in which they were added. If necessary use the **LB_FINDSTRING** or **LB_FINDSTRINGEXACT** message to discover a string' | ||
+ | <code bb4w> | ||
DEF PROC_addstring(hlb%, | DEF PROC_addstring(hlb%, | ||
LOCAL E%, I%, max%, nitems% | LOCAL E%, I%, max%, nitems% | ||
Line 84: | Line 95: | ||
SYS " | SYS " | ||
= size.x% | = size.x% | ||
+ | </ | ||
Note that, for convenience, | Note that, for convenience, |
scrollable_20list_20boxes.1522502379.txt.gz · Last modified: 2024/01/05 00:16 (external edit)