sandyrepope
10-08-2007, 05:26
Here is an example of using the script to control when a button works.
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, "Button 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?
control disable hDlg, %id_button 'disable button
sleep 1000 'do a little wait and then
control enable hDlg, %id_button 'make button work 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
Thanks
Sandy
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, "Button 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?
control disable hDlg, %id_button 'disable button
sleep 1000 'do a little wait and then
control enable hDlg, %id_button 'make button work 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
Thanks
Sandy