cmcb Posted October 8, 2011 Share Posted October 8, 2011 Hi Guys I have a GUI with multiple buttons. I want to display a message when the user clicks on 2 particular buttons (i.e. clicks 1 then 2 ) output an alert msg. Clicking 1 on it's own or 2 on it's own would do nothing. Similarly, 2 then 1 wouldn't do anything. Is this possible? I see there's an _IsPressed function but not sure if it applies to buttons or just keyboard input. Thanks Link to comment Share on other sites More sharing options...
bestsmr Posted October 8, 2011 Share Posted October 8, 2011 it is easy try this code #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form1", 296, 349, 192, 124) $Button1 = GUICtrlCreateButton("Button1", 48, 24, 177, 57) $Button2 = GUICtrlCreateButton("Button2", 48, 112, 193, 49) $Button3 = GUICtrlCreateButton("Button3", 40, 192, 201, 49) $Button4 = GUICtrlCreateButton("Button4", 48, 264, 193, 41) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### Local $pressed_1=False While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 $pressed_1=True Case $Button2 if $pressed_1 then MsgBox(0,"result","2 pressed after 1") $pressed_1=False EndIf Case $Button3 $pressed_1=False Case $Button4 $pressed_1=False EndSwitch WEnd Link to comment Share on other sites More sharing options...
cmcb Posted October 8, 2011 Author Share Posted October 8, 2011 Magic!! Thank you Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now