Sign in to follow this  
Followers 0
atnextc

Close Secondary GUI while not closing script issue

4 posts in this topic

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

 

Share this post


Link to post
Share on other sites



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.

Share this post


Link to post
Share on other sites

Thanks Tjalve I"ll try that, didn't even think about it.  I"ll report back with findings.

Share this post


Link to post
Share on other sites

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._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

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  
Followers 0