I wasn't in the mood to do any real work so I came up with this:
[code=thinbasic]uses "UI" 'use UI module
DIM hDlg AS DWORD 'dialog number assigned by OS
dim Msg, wparam,lparam as dword 'parameters used for os messages
%id_button = 10 'assign number to button to identify it
'make a window
DIALOG NEW 0, "Something FUN", -1, -1, 150, 100, _
%WS_DLGFRAME OR %DS_CENTER OR %WS_CAPTION OR %WS_SYSMENU OR %WS_OVERLAPPEDWINDOW, _
0 TO hDlg
'add a button to it
control add button, hDlg, %id_button, "CLICK ME", 5, 5, 50, 50, %ws_border
DIALOG SHOW modeless hDlg 'make window visible
while isWindow(hDlg) 'while loop to handle messages from OS
Msg = GetMessage(hDlg, wParam, lParam) 'get latest message
select case Msg 'message that was recieved
case %wm_command 'check command
select case wParam 'it will be here
case %id_button 'was button clicked?
dialog show state hDlg, 0 'make window invisible
sleep 1000 'do a little wait and then
dialog show state hDlg, 1 'make window visible again
end select
CASE %WM_SYSCOMMAND 'system command?
SELECT CASE wParam 'check variable
CASE %SC_CLOSE 'if close button in bar clicked then
EXIT WHILE 'exit while which will end program
END SELECT
END SELECT
wend
DIALOG END hDlg 'ends the program
[/code]
What does it do? When the button is clicked the window vanishes and then after a few milliseconds returns. I know that is a silly thing to do but it does show how to use the command "dialog show state". I just learned how to do this.
Thanks
Sandy
Bookmarks