Maybe I'm late catching on, but I've not seen it mentioned either. {If a GLOBAL is best, then use it. I disagree with avoiding GLOBALs at all costs.} Anyway:
To change menu text I needed the menu's handle, hMenu, created in a FUNCTION with the DIALOG and CONTROLs, to be available in the CALLBACK FUNCTION. An obvious (and least thinking applied
) choise is a GLOBAL.
Somehow it occurred to me that dialog USER variables were accessable in both functions. The only additional thing needed is the dialog handle. So hDlg any time after DIALOG NEW, and CB.HNDL in the callback.
Specific example code lines:
DIALOGs and CONTROLs each have 8 USER variables. LISTBOXes, COMBOBOXes and LISTVIEWs also have one USER variable per line/row. In Help see DIALOG GET USER, DIALOG SET USER, CONTROL GET USER, CONTROL SET USER, COMBOBOX GET USER, COMOBOX SET USER, LISTBOX GET USER, LISTBOX SET USER, LISTVIEW GET USER and LISTVIEW SET USER.
Cheers,
To change menu text I needed the menu's handle, hMenu, created in a FUNCTION with the DIALOG and CONTROLs, to be available in the CALLBACK FUNCTION. An obvious (and least thinking applied


Specific example code lines:
Code:
' ... DIALOG NEW 0, "Caption text", x, y, xx, yy TO hDlg ... MENU NEW BAR TO hMenu DIALOG SET USER hDlg, 1, hMenu ... 'in callback ... CASE %WM_INITDIALOG STATIC hMenu as long DIALOG GET USER CB.HNDL, 1 TO hMenu ... CASE some_ event MENU SET TEXT hMenu, position_or_BYCMD_ID, new_text 'menu strings have position and ID, popups only position MENU DRAW BAR CB.HNDL ...
Cheers,
Comment