Hi daveC,
building a GUI application is quite simple, you just have to keep in mind the concept.
You can use thinForm to generate layout for you or do following in thinAir:
- click File/New/NewFile/
- From templates choose GUI/CustomDialogWithButton.taguit
That will generate minimal sample of Windows GUI application for you.
The "forms" are called "dialogs" in thinBASIC. Dialog is identified by its handle - unique identifier, typically named like "hDlg" ( handle-of-dialog ).
To such a dialog you can add various controls - buttons, textboxes ... each of this controls has its identifier too, to be manipulable later. So each control has specified mainly handle of dialog it belongs to, own ID, position and other details.
Once you define dialog and its controls, you can show it using "DIALOG SHOW MODELESS hDlg" for example.
To be able to react on events ( button clicked, dialog closed ), you have to read messages in cycle, typically looking like:
[code=thinbasic]
' -- Performs loops as long as dialog is "alive"
While ISWINDOW(hDlg)
' -- Get dialog messages - to Msg the type of message is stored, wParam and lParam contain message specific parameters
Msg = GETMESSAGE(hDlg, wParam, lParam)
' -- Now we will determine which message was fired for the >dialog< ... and manage it somehow
Select Case Msg
Case %WM_Command
' -- Here you can process the input from controls
' -- Ctrl identifier
Ctrl = loWrd(wParam)
' -- >Control< specific message
CtrlMsg = HiWrd(wParam)
' -- According to which control we will react
select case Ctrl
case %btnClose
if CtrlMsg = 0 then exit while
end select
Case %WM_SYSCOMMAND
If wParam = %SC_Close Then Exit While
End Select
Wend
' -- Once we are out of main dialog loop, the dialog should be destroyed
DIALOG END hDlg
[/code]
Hope I put more light on this topic.
There was a nice tutorial on dialogs in thinBASIC, but in italian language. Here is a link to machine translated page.
For more samples please see SampleScripts/UI/ folder.
Petr
Bookmarks