Please enable JavaScript to view this site.

thinBasic Help Manual

Navigation: ThinBASIC Modules > UI (User Interface) > DIALOGS

Dialog Low Level Event Handling

Scroll Prev Top Next More

* * HELP & MANUAL PREMIUM PACK 4 DEMO VERSION * *

This documentation was styled with a demo skin from the Premium Pack 4 add-on for Help & Manual. The contents of the skin are encrypted and not configurable. You can only publish HM projects with this skin. You cannot edit it or change it.

This version is copyright and may only be used for local testing purposes. It may not be distributed.

Please purchase the full version of the Premium Pack to get the configurable skins and remove this notice. The package will also include the Toolbox configuration utility for Premium Pack skins.

 

You can mimic the Win32 low level approach by passing callback function name to the DIALOG SHOW MODAL or DIALOG SHOW MODELESS commands.

 

You can see how cbDialog is used as such a callback function in the following example. Notice the callback function takes no parameters:

 

uses "UI"

 

'---Define a button ID

%ButtonClose = 1001

 

dWord hDlg

 

dialog new 0, "APPTITLE",-1,-1, 330, 203, %WS_POPUP | %WS_VISIBLE | %WS_CLIPCHILDREN | %WS_CAPTION | %WS_SYSMENU %WS_MINIMIZEBOX to hDlg

 

control add button, hDlg, %ButtonClose, "Click to kill", 90, 50, 150, 100

 

dialog show modal hDlg call cbDialog

 

'------------------------------------------------

' Callback function used to handle dialog events

'------------------------------------------------

callback function cbDialog() as long

 

  select case Callback_Message

    case %WM_Command

      if Callback_WPARAM = %ButtonClose then dialog end Callback_Handle

 

    case %WM_DESTROY

      msgbox Callback_Handle"Window is to be destroyed."

      

  end select 

 

end function

 

Please note mastering the low level dialog handling requires advanced knowledge and study of Win32 technology. This interface is therefore meant for experienced Win32 warriors who know what is %WM_COMMAND and what to expect from WPARAM and LPARAM for each of the messages.

 

Good starting point for study is Microsoft documentation here:

https://docs.microsoft.com/en-us/windows/win32/learnwin32/writing-the-window-procedure

 

Please note the difference that callback function in thinBasic does not retrieve the parameters so hWnd parameter is available for you via Callback_Handle, uMsg via Callback_Message, wparam via Callback_WParam and lparam via Callback_LParam.

 

If you don't have time to invest in this study, consider going the high level route.

Created with Help+Manual 8 and styled with Premium Pack Version 4 © by EC Software