Thanks for sharing Sandy !,
you can also use following equates to not use directly numbers in DIALOG SHOW STATE.
I think I have seen them in helpfile somewhere.
[code=thinBASIC]
%SW_HIDE
%SW_RESTORE
[/code]
Thanks,
Petr
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
Thanks for sharing Sandy !,
you can also use following equates to not use directly numbers in DIALOG SHOW STATE.
I think I have seen them in helpfile somewhere.
[code=thinBASIC]
%SW_HIDE
%SW_RESTORE
[/code]
Thanks,
Petr
Learn 3D graphics with ThinBASIC, learn TBGL!
Windows 10 64bit - Intel Core i5-3350P @ 3.1GHz - 16 GB RAM - NVIDIA GeForce GTX 1050 Ti 4GB
Thanks Sandy, seeing these kind of useful snippets of code are great for everyone. Hiding and unhiding a window can be very important so nice example.
Acer Notebook: Win 10 Home 64 Bit, Core i7-4702MQ @ 2.2Ghz, 12 GB RAM, nVidia GTX 760M and Intel HD 4600
Raspberry Pi 3: Raspbian OS use for Home Samba Server and Test HTTP Server
Thanks, Petr. I tried the two % variables and they make the two lines clearer as to what is happening.
Kryton9. Thanks for the kind words. I hoped that this might be useful to someone. I wish I could get more ideas for things like this. Maybe when I learn even more.
Thanks
Sandy
Thanks a lot Sandy for those examples.
I've moved your post in this more appropriate forum.
Ciao
Eros
www.thinbasic.com | www.thinbasic.com/community/ | help.thinbasic.com
Windows 10 Pro for Workstations 64bit - 32 GB - Intel(R) Xeon(R) W-10855M CPU @ 2.80GHz - NVIDIA Quadro RTX 3000
Bookmarks