litlmike Posted February 22, 2006 Share Posted February 22, 2006 I want to exit the GUI when the user hits 'Done' then start my next function ('Func WriteProposal()'). I spent an hour testing different ways to set up the do, if...then, while, for, etc. And I spent another hour searching the forums and reading tutorials, but I can't find the answer. The great and omnipresent 'Valuater' helped me get this far. I marked where I think the problem is. How do I make it close the GUI, then activate my next function? Thanks ahead of time! expandcollapse popup;Open GUI Func OpenGUI() #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() ;***** RIGHT HERE******** 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 EndFunc ;Write Proposal Func WriteProposal() ... ... ... EndFunc _ArrayPermute()_ArrayUnique()Excel.au3 UDF Link to comment Share on other sites More sharing options...
Valuater Posted February 22, 2006 Share Posted February 22, 2006 expandcollapse popup;Open GUI ;Func OpenGUI(); normally the first gui is not within a function ( depends ) #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 Buttons $done = GUICtrlCreateButton("Done", 25, 170, 75, 50) $Calc = GUICtrlCreateButton("Calculate", 125, 170, 75, 50) GUISetState() ; will display an empty dialog box ; Run the GUI until the dialog is closed Do $msg = GUIGetMsg() ;***** RIGHT HERE******** If $msg = $done Then Exit If $msg = $Calc Then WriteProposal() 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 ;EndFunc ;Write Proposal Func WriteProposal() $cat_1A = GUICtrlRead($cat_1) MsgBox(64, "Proposal", "Started with " & $cat_1A) EndFunc ;==>WriteProposal 8) Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted February 23, 2006 Moderators Share Posted February 23, 2006 ;Write Proposal Func WriteProposal() $cat_1A = GUICtrlRead($cat_1) MsgBox(64, "Proposal", "Started with " & $cat_1A) EndFunc ;==>WriteProposalThis should throw an error? If $msg = $Calc Then WriteProposal($cat_1) ;Write Proposal Func WriteProposal($cat_1) $cat_1A = GUICtrlRead($cat_1) MsgBox(64, "Proposal", "Started with " & $cat_1A) EndFunc ;==>WriteProposalMaybe? Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
gamerman2360 Posted February 23, 2006 Share Posted February 23, 2006 (edited) You want WriteProposal() to fire when the GUI is done? Have the exit keyword try to get the value of WriteProposal() when it tries to exit for the exit code. That or use OnAutoItExit().If $msg = $done Then Exit WriteProposal() Edited February 23, 2006 by gamerman2360 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