Jump to content
Sign in to follow this  

GUI buttons: output alert when clicked in sequence

Recommended Posts

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.


Share this post

Link to post
Share on other sites

it is easy try this code :graduated:

#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)
#EndRegion ### END Koda GUI section ###
Local $pressed_1=False
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
  Case $Button1
  Case $Button2
   if $pressed_1 then
    MsgBox(0,"result","2 pressed after 1")
  Case $Button3
  Case $Button4

Share this post

Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...