08-15-2013, 07:46 PM
QM does not have a toolbar scope for variables.
In this case you can use global variables.
All global variables are available in all macros. Use unique names to avoid conflicts.
QM does not have read-only variables.
If need to initialize/clear variables when the toolbar is created/destroyed, you can do it in a toolbar hook function. Then also can allocate/attach non-global variables to the toolbar, but it is not easy.
Toolbar Toolbar47
Function WndProc_ToolbarHook3
As always, use lock where a global variable may be accessed by multiple threads simultaneously.
In this case you can use global variables.
All global variables are available in all macros. Use unique names to avoid conflicts.
QM does not have read-only variables.
If need to initialize/clear variables when the toolbar is created/destroyed, you can do it in a toolbar hook function. Then also can allocate/attach non-global variables to the toolbar, but it is not easy.
Toolbar Toolbar47
Function WndProc_ToolbarHook3
;/
function# hWnd message wParam lParam
;OutWinMsg message wParam lParam ;;uncomment to see received messages
;to avoid many global variables, use a user-defined type
type TB47VARIABLES
,x y
,str'text
TB47VARIABLES+ g_tb47
sel message
,case WM_INITDIALOG
,;you can initialize global variables here, or in other macro
,g_tb47.x=5
,g_tb47.text="toolbar"
,
,case WM_DESTROY
,;clear global variables here
,g_tb47.text.all
As always, use lock where a global variable may be accessed by multiple threads simultaneously.