Sign in to follow this  
Followers 0

hide and restore help

3 posts in this topic

#1 ·  Posted (edited)

when i open the gui the hide button works fine, then when i click restore in the tray, it works fine. But then I try and press hide again to hide it or exit to exit out.... and it does nothing. What am I doing wrong?

Here is my code.

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $exitBtn
            Exit
        Case $hideBtn
            Hide()
        Case $startBtn
            Start()
    EndSwitch
WEnd

While 1
    $msg = GUIGetMsg()
    Select
                Case $msg = 0
                        ContinueLoop
        Case $msg = $restoreitem
            GUISetState(@SW_SHOW, $mainGUI)
        Case $msg = $hideitem
            GUISetState(@SW_HIDE, $mainGUI)
        Case $msg = $aboutitem
            Msgbox(64,"about:","created by Webber04")
        Case $msg = $exititem
            Exit
    EndSelect
WEnd

Func Hide()
    GUISetState(@SW_HIDE, $mainGUI)
    While 1
        Sleep(10)
    WEnd
    Exit
EndFunc

Func AboutClick()
    MsgBox(0, "About", "by Webber04")
EndFunc   ;==>AboutClicked

Func RestoreClick()
    GUISetState(@SW_SHOW, $mainGUI)
EndFunc   ;==>RestoreClicked

Func ExitEvent()
    Exit
EndFunc
Edited by vladedoty

Share this post


Link to post
Share on other sites



#2 ·  Posted

vladedoty,

The first thing I noticed was 2 GUIGetMsg() loops - why?

And then when I looked at your Hide function, I found this:

Func Hide()
    GUISetState(@SW_HIDE, $mainGUI)
    While 1
        Sleep(10)
    WEnd
    Exit
EndFunc

This function will never end as you set up an infinite loop with no possibility of exit.

So it is hardly surprising that your script has problems. Please post the full script - at the moment it is impossible to say what else might be causing you problems.

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:

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 and edit 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

#3 ·  Posted

vladedoty,

The first thing I noticed was 2 GUIGetMsg() loops - why?

And then when I looked at your Hide function, I found this:

Func Hide()
    GUISetState(@SW_HIDE, $mainGUI)
    While 1
        Sleep(10)
    WEnd
    Exit
EndFunc

This function will never end as you set up an infinite loop with no possibility of exit.

So it is hardly surprising that your script has problems. Please post the full script - at the moment it is impossible to say what else might be causing you problems.

M23

nevermind i fixed it.

just added the l2 GUIMSG to the Start function.

and thx to your help, got rid of the while loop in the hide function.

Thx again

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