Jump to content

How Do I close GUI when the User hits the Button


litlmike
 Share

Recommended Posts

I just want to have the GUI close/exit when the user clicks the done button. How do I do that?

#include <GUIConstants.au3>

;Make GUI

GUICreate ( "Input Proposal Info", 225, 250)

GUISetState (@SW_SHOW) ; will display an empty dialog box

;Make first Combo Box

$cat_1 = GUICtrlCreateCombo ( "Pick A Category", 10, 10)

GUICtrlSetData(-1,"item1|item2|item3"); Set data in Combo Box

;Second Combo Box

$cat_2 = GUICtrlCreateCombo ( "Pick A Category", 10, 50)

GUICtrlSetData(-1,"item1|item2|item3"); Set data in Combo Box

;Third Combo Box

$cat_3 = GUICtrlCreateCombo ( "Pick A Category", 10, 90)

GUICtrlSetData(-1,"item1|item2|item3"); Set data in Combo Box

;Make Discount Input Box

$discount = GUICtrlCreateInput ( "Enter Discount", 10, 130)

;Make Done Button

$done = GUICtrlCreateButton ( "Done", 75, 170,75,50)

GUISetState () ; will display an empty dialog box

; Run the GUI until the dialog is closed

Do

$msg = GUIGetMsg()

if $msg = $cat_1 then

GUICtrlRead($cat_1); get the value

GUICtrlRead($discount) ; get the value

endif

if $msg = $cat_2 then

GUICtrlRead($cat_2); get the value

GUICtrlRead($discount); get the value

endif

if $msg = $cat_3 then

GUICtrlRead($cat_3); get the value

GUICtrlRead($discount); get the value

endif

Until $msg = $GUI_EVENT_CLOSE

Link to comment
Share on other sites

like this

#include <GUIConstants.au3>

;Make GUI
GUICreate ( "Input Proposal Info", 225, 250)
GUISetState (@SW_SHOW); will display an empty dialog box

;Make first Combo Box
$cat_1 = GUICtrlCreateCombo ( "Pick A Category", 10, 10)
GUICtrlSetData(-1,"item1|item2|item3"); Set data in Combo Box

;Second Combo Box
$cat_2 = GUICtrlCreateCombo ( "Pick A Category", 10, 50)
GUICtrlSetData(-1,"item1|item2|item3"); Set data in Combo Box

;Third Combo Box
$cat_3 = GUICtrlCreateCombo ( "Pick A Category", 10, 90)
GUICtrlSetData(-1,"item1|item2|item3"); Set data in Combo Box

;Make Discount Input Box
$discount = GUICtrlCreateInput ( "Enter Discount", 10, 130)

;Make Done Button
$done = GUICtrlCreateButton ( "Done", 75, 170,75,50)

GUISetState (); will display an empty dialog box
; Run the GUI until the dialog is closed
Do
$msg = GUIGetMsg()

If $msg = $done Then Exit

if $msg = $cat_1 then
GUICtrlRead($cat_1); get the value
GUICtrlRead($discount); get the value
endif

if $msg = $cat_2 then
GUICtrlRead($cat_2); get the value
GUICtrlRead($discount); get the value
endif

if $msg = $cat_3 then
GUICtrlRead($cat_3); get the value
GUICtrlRead($discount); get the value
endif

Until $msg = $GUI_EVENT_CLOSE

8)

NEWHeader1.png

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...