Another improvement added - better to say a few of them:
This now can create a skeleton that includes global keyboard-watch, alternative to Accel Attach - so shortcuts will work always, no matter what currently has focus. Therefore it creates also "Events" to MenuItems, so you don't need to handle Menu-Items in callback: each menuItem gets created it's own sub if you decide to include the Keyboard-Check- the call of the subs is contained in callbacks & shortcuts. For these Shortcuts there will be next to TBMain a TBKeyboard-Function which gets called from Main-Loop - and you can add any global keyboard-related actions there. By default it contains to end the app on escape-key. You also can add shortcuts to any other control if you like to, just stick to the way of the template then and send those CBCTL-cases with the needed parameters to some sub like
'...your example-sub
Sub OnClick_ID_myButton(Byval hDlg as Dword)
' write here what happens if ID_myButton gets clicked
' if hDlg = 0 then this call came from keyboard
End Sub
'...within callback
'...
Case %WM_Command
Select Case CBCTL
Case ID_MyButton
If CBMSG = %BN_Clicked Then OnClick_ID_myButton(CBHNDL)
'...
'... your shortcut within TBMain
'...
While keepRunning
Dialog DoEvents To NumberOfDialogsAlive
Select Case TBKeyboard
Case %VK_ESCAPE
keepRunning = FALSE
Case %VK_F12 ' lets say it shall react on CTRL+F12:
If GetAsyncKeyState(%VK_CONTROL) Then
OnClick_ID_myButton(0)
EndIf
'...
Also possible to include mouse-handling to callbacks, so the skeleton contains all mouse-stuff within callbacks and creates a generic mouse-UDT. I refrained from adding equates for mouse-button-states here, I just used values which mean
0 - mousebutton nothing
1 - mousebutton just went down
2 - mousebutton hold down
-1 - mousebutton just released
I would like to use Name-option for dialogs -
but there are two problems: currently the automatic control-callbacks are not done yet (this is the smaller problem)
and sizes of dialogs & controls do not match the sizes during creation - not if Dialog New Name, Pixels nor Units are used.
Bookmarks