catventure
28-10-2008, 19:04
Hi,
I had some code OUTSIDE the Dialog Window Main Loop to check for a SPACE keypress and soon after in a different function called a MSGBOX with YES/NO buttons...
Below is cut-down code:
GETWINDOWKEYSTATE( hwnd, -1 )
DO
'---trap space keypress
IF getwindowkeystate(hwnd, %VK_SPACE ) THEN
sleep 200
EXIT DO
END IF
LOOP
GETWINDOWKEYSTATE( hwnd, -1 )
'REM: The messagebox below does not show up!!!
Retcode=MSGBOX( hwnd, "Some Text", %MB_YESNO or %mb_iconquestion, "Some Text" )
SELECT CASE Retcode
CASE %IDYES
etc...etc
Keypress worked fine but the msgbox above never showed up...!
I discovered that somehow the SPACE was being interpreted as a YES for variable Retcode and the CASE %IDYES was being immediately processed without the msgbox appearing for the user to make a choice... It is odd. I solved it (after some time) by adding a MSGBOX to the keypress routine like so:
GETWINDOWKEYSTATE( hwnd, -1 )
DO
'---trap space keypress
IF getwindowkeystate(hwnd, %VK_SPACE ) THEN
sleep 200
EXIT DO
END IF
LOOP
GETWINDOWKEYSTATE( hwnd, -1 )
'REM: Blank messagebox below does not appear at all - but nullifies SPACE keypress!!
MSGBOX hwnd,""
'Messagebox now appears correctly!!
Retcode=MSGBOX( hwnd, "Some Text", %MB_YESNO or %mb_iconquestion, "Some Text" )
SELECT CASE Retcode
CASE %IDYES
etc...etc
I am using version 1.6.0.10
Regards,
catventure
I had some code OUTSIDE the Dialog Window Main Loop to check for a SPACE keypress and soon after in a different function called a MSGBOX with YES/NO buttons...
Below is cut-down code:
GETWINDOWKEYSTATE( hwnd, -1 )
DO
'---trap space keypress
IF getwindowkeystate(hwnd, %VK_SPACE ) THEN
sleep 200
EXIT DO
END IF
LOOP
GETWINDOWKEYSTATE( hwnd, -1 )
'REM: The messagebox below does not show up!!!
Retcode=MSGBOX( hwnd, "Some Text", %MB_YESNO or %mb_iconquestion, "Some Text" )
SELECT CASE Retcode
CASE %IDYES
etc...etc
Keypress worked fine but the msgbox above never showed up...!
I discovered that somehow the SPACE was being interpreted as a YES for variable Retcode and the CASE %IDYES was being immediately processed without the msgbox appearing for the user to make a choice... It is odd. I solved it (after some time) by adding a MSGBOX to the keypress routine like so:
GETWINDOWKEYSTATE( hwnd, -1 )
DO
'---trap space keypress
IF getwindowkeystate(hwnd, %VK_SPACE ) THEN
sleep 200
EXIT DO
END IF
LOOP
GETWINDOWKEYSTATE( hwnd, -1 )
'REM: Blank messagebox below does not appear at all - but nullifies SPACE keypress!!
MSGBOX hwnd,""
'Messagebox now appears correctly!!
Retcode=MSGBOX( hwnd, "Some Text", %MB_YESNO or %mb_iconquestion, "Some Text" )
SELECT CASE Retcode
CASE %IDYES
etc...etc
I am using version 1.6.0.10
Regards,
catventure