Sign in to follow this  
Followers 0
Clay

Closing GUI

6 posts in this topic

#1 ·  Posted (edited)

How can I close a GUI by my own will...meaning that I have created a button and once that button is pressed

-> I want to run a few processes

-> Then I want the GUI to disappear once the processes under that button have completed

-> Then move on to the rest of my script

I have tried using the $GUI_EVENT_CLOSE .. but that didn't work, and I have tried GUISetState(@WS_HIDE), but that didn't work either. I have tried a few other things that gave me no results.

I know that is a simple thing to do but I just can't seem to get what I want so jsut wondering it anyone knows what function I should use.

Help!

Here is some code

Local $PWVD 
Local $Label1
Local $Label2
Local $Products
Local $ProdVerions
Local $Download
Local $AProduct
Local $tmp
Local $getSelect
Global $DResult
Global $DevFile
Global $GuiResults[2]

Dim $fileSplitArray[2]
Dim $FindExe, $szDrive, $szDir, $szFName, $szExt

Func Gui()
$PWVD = GUICreate("PWVD DevCentral Download Interface", 382, 122, 313, 210)
GUISetBkColor(0xD4D0C8)
$Label1 = GUICtrlCreateLabel("Select a Product ", 32, 16, 110, 17)
$Label2 = GUICtrlCreateLabel("Select a Version", 232, 16, 99, 17)
$Products = GUICtrlCreateCombo("", 32, 40, 121, 25)
$ProdVerions = GUICtrlCreateCombo("", 232, 40, 73, 25)
$Download = GUICtrlCreateButton("Download", 136, 80, 97, 25, 0)
GUISetState(@SW_SHOW)

$AProduct = getDownload()
    For $i = 0 To Ubound($AProduct)-1
        $tmp &= $AProduct[$i]& "|"
    Next
    $tmp = StringTrimRight($tmp,1)
GUICtrlSetData($Products,$tmp)
While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Label1
        Case $Products
        Case $ProdVerions
        Case $Download
            $getSelect = GUICtrlRead(($Products))
            $DevFile = fileSplit($getSelect)
        ;$DResult = True 
        ;$GuiResults[0] = $DevFile
        ;$GuiResults[1] = $DResult
            Return $DevFile
        EndSwitch
WEnd
EndFunc
Edited by Clay

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

How can I close a GUI by my own will...meaning that I have created a button and once that button is pressed

-> I want to run a few processes

-> Then I want the GUI to disappear once the processes under that button have completed

-> Then move on to the rest of my script

I have tried using the $GUI_EVENT_CLOSE .. but that didn't work, and I have tried GUISetState(@WS_HIDE), but that didn't work either. I have tried a few other things that gave me no results.

I know that is a simple thing to do but I just can't seem to get what I want so jsut wondering it anyone knows what function I should use.

Help!

GUIDelete() Or GUISetState(@SW_HIDE) :)

Edit: Also make sure the GUI is "activated" with GUISwitch.

Edited by monoceres

Broken link? PM me and I'll send you the file!

Share this post


Link to post
Share on other sites

Momoceres,

Thanks for you help, but GUISetState(@SW_HIDE) or GUIDelete() don't seem to work at all.

Share this post


Link to post
Share on other sites

I tested some and I have no problems with GUIDelete, you did pass $PWVD to it?: GUIDelete($PWVD)


Broken link? PM me and I'll send you the file!

Share this post


Link to post
Share on other sites

I did... placed it under the $Download Button since I want it to be executed under that button ... .but still nothing

Share this post


Link to post
Share on other sites

I did... placed it under the $Download Button since I want it to be executed under that button ... .but still nothing

Most likely it's never even executed. Try using OnEvent code instead, it's much easier to debug.


Broken link? PM me and I'll send you the file!

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