Jump to content

Basic GUI with 2 buttons


 Share

Recommended Posts

Hi guys,

Could someone please give me a head start with creating a GUI?

For my current project I want to prompt the user with a Message type box with a title, description/question & 2 buttons with the button text "Big" and "Small" and the resulting code execution based on which button they press.

That'd be a big help - thanks guys.

Link to comment
Share on other sites

#include <GUIConstants.au3>

GUICreate ( "Insert title Here...", 266,91)

GUICtrlCreateLabel ( "Insert question here...", 20, 10, 200, 20)

$Big = GUICtrlCreateButton ( "Big", 20, 50, 100)
$Small = GUICtrlCreateButton ( "Small", 146, 50, 100)

GUISetState()

While 1
   $msg = GUIGetMsg()
   Select
      Case $msg = $GUI_EVENT_CLOSE
         ExitLoop
      Case $msg = $Big
        ;Insert Code Here
      Case $msg = $Small
        ;Insert Code Here
   EndSelect  
Wend

That will get you started. Because you wanted custom text on the button we couldnt just use a simple Msgbox() Function as the buttons can only contain set text such as "Yes", "No", "Retry" etc. Instead I had to create a custom GUI window that looks like a message box.

qq

Link to comment
Share on other sites

Thanks for that.

It's just the kick start I needed to start getting my head around it (as i've only created GUIs visually before).

#include <GUIConstants.au3>

GUICreate ( "Insert title Here...", 266,91)

GUICtrlCreateLabel ( "Insert question here...", 20, 10, 200, 20)

$Big = GUICtrlCreateButton ( "Big", 20, 50, 100)
$Small = GUICtrlCreateButton ( "Small", 146, 50, 100)

GUISetState()

While 1
   $msg = GUIGetMsg()
   Select
      Case $msg = $GUI_EVENT_CLOSE
         ExitLoop
      Case $msg = $Big
        ;Insert Code Here
      Case $msg = $Small
        ;Insert Code Here
   EndSelect  
Wend

That will get you started. Because you wanted custom text on the button we couldnt just use a simple Msgbox() Function as the buttons can only contain set text such as "Yes", "No", "Retry" etc. Instead I had to create a custom GUI window that looks like a message box.

<{POST_SNAPBACK}>

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...