Added December 2013
Dialogs can be made vertically scrollable by specifying the WS_VSCROLL in the winstyle parameter when the dialog is created. For example:
...
|
Code for example above.
! create dialog with vertical scroll bar
winstyle = WS_VSCROLL
xcall AUI, AUI_CONTROL, CTLOP_ADD, "dlg1", "Scrolling Dialog", &
MBST_ENABLE, MBF_DIALOG, NUL_CMD$, NUL_FUNC$, NUL_CSTATUS, &
4000, 10000, 10000, 40000, NUL_FGC, NUL_BGC, &
NUL_FONTATTR, NUL_FONTSCALE, NUL_FONTFACE$, NUL_TOOLTIP$, &
NUL_PARENTID, NUL_WINCLASS$, winstyle, NUL_WINSTYLEX, NUL_CTYPE2
! create a bunch of fields that extend arbitrarily below bottom of dialog
row = 500
for fno = 1 to num'fields
row += 1000
xcall SBXINP, "<2>"+label$(fno), INFOP_DISPLAY, row, 8, xmax(fno), &
field$(fno), "|GA||C]g123T", setdef$, 50, fno+100, tooltip$, "dlg1", &
exitcode, -1, 0, 0, -1
next fno
The scroll bar will be automatically configured / calibrated as fields are added to the dialog, and the EVENTWAIT routine will automatically scroll the currently focused field into view.
Note that this works for all types of dialogs, including MBF_DLGNOCAP dialogs, which can be positioned within parent windows or panels (such as Tab panels), allowing you to effectively creating scrollable regions within a larger window.
Code for example above.
To produce this dialog, we modify the code from the first example as follows:
! main dialog (not scrollable)
xcall AUI, AUI_CONTROL, CTLOP_ADD, "dlg0", "Dialog with scrollable region", &
MBST_ENABLE, MBF_DIALOG, NUL_CMD$, NUL_FUNC$, NUL_CSTATUS, &
4000, 10000, 12000, 40000, NUL_FGC, &hffeeee
! ok and cancel buttons at top, in non-scolling region
xcall AUI, AUI_CONTROL, CTLOP_ADD, "btnOK", "OK", &
MBST_ENABLE, MBF_BUTTON+MBF_KBD, "VK_xF5", NUL_FUNC$, NUL_CSTATUS, &
1500, 13000, 3000, 20000
xcall AUI, AUI_CONTROL, CTLOP_ADD, "btnCancel", "Cancel", &
MBST_ENABLE, MBF_BUTTON+MBF_KBD, "VK_ESC", NUL_FUNC$, NUL_CSTATUS, &
1500, 22000, 3000, 29000
! scrollable borderless dialog within main dialog
xcall AUI, AUI_CONTROL, CTLOP_ADD, "dlg1", NUL_CTEXT$, &
MBST_ENABLE, MBF_DIALOG, NUL_CMD$, NUL_FUNC$, NUL_CSTATUS, &
3000, 0, 8500, 31000, NUL_FGC, &hffdddd, &
NUL_FONTATTR, NUL_FONTSCALE, NUL_FONTFACE$, NUL_TOOLTIP$, &
NUL_PARENTID, NUL_WINCLASS$, WS_VSCROLL+WS_BORDER, NUL_WINSTYLEX, &
MBF2_DLGNOCAP+MBF2_STICKY
! create a bunch of fields that extend arbitrarily below bottom of window
! <same as before, fields owned by dlg1 which is now a captionless dialog within dlg0