atnextc Posted August 7, 2013 Share Posted August 7, 2013 I have a script that writes some configs for work, those configs are presented in a secondary gui window that pops up for the user, they click "copy to clipboard" and hit exit. The problem is that when they close the secondary window, the script exits, and doesn't return back to the first gui with cleared out input boxes, as if it was just run for the first time again. below is the code for the function that creates the secondary input box. Func _NoMoreTrafficAddProjects() $FinalTrafficAddConfig = ("Final Traffic Add Config.txt") $EmailForm = GUICreate("Traffic Add MOP", 831, 518, 188, 222) $CoxLabel = GUICtrlCreateLabel("Traffic Add MOP ", 25, 22, 780, 41) GUICtrlSetFont(-1, 24, 400, 0, "MS Sans Serif") $EmailEdit = GUICtrlCreateEdit("", 32, 72, 761, 401, BitOR($ES_MULTILINE, $WS_VSCROLL)) GUICtrlSetState(-1, $GUI_HIDE) GUICtrlSetData(-1, "") $CopyButton = GUICtrlCreateButton("Copy To Clipboard", 680, 480, 99, 25) Local $test = FileRead("Final Traffic Add Config.txt") ClipPut($test) FileClose($FinalTrafficAddConfig) FileDelete("Final Traffic Add Config.txt") GUICtrlSetData($EmailEdit, ClipGet()) GUICtrlSetState($EmailEdit, $GUI_SHOW) GUISetState(@SW_SHOW) ClipPut("") WinWaitClose("Traffic Add MOP") GUISetState(@SW_SHOW,$C4Automation) EndFunc ;==>_NoMoreTrafficAddProjects I also noticed that once I took out a bsgbox that asked a question at the end of the function, that the scripts starts the original function that called this one all by its self and i can't figure out why. Just trying to be able to close a gui window, and bring up the first window with cleared out input boxes. Thanks Link to comment Share on other sites More sharing options...
Tjalve Posted August 7, 2013 Share Posted August 7, 2013 Im guessing you have a Case $GUI_EVENT_CLOSE Exit somewhere? In that case it checks if someone clicks in the "x" och sen execute that code,. In this case the "exit". So you could just put a if statement in there that checks what GUI is active. If GUI 2 is active, just close it and enable GUI 1 istead. And if GUI 1 is active, then exit. Link to comment Share on other sites More sharing options...
atnextc Posted August 7, 2013 Author Share Posted August 7, 2013 Thanks Tjalve I"ll try that, didn't even think about it. I"ll report back with findings. Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted August 7, 2013 Moderators Share Posted August 7, 2013 atnextc,I recommend reading the Managing Multiple GUIs tutorial in the Wiki. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area 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