Jump to content
Sign in to follow this  
Syl21

Exit a Function

Recommended Posts

Syl21

Hello,

I have create a lite script, so you can try...

I have a first graphical interface and when you select "+" that open a second graphical function

The question is:

How can I close this new graphical function without closing my software???

Thx in Adv

#include <GUIConstantsEx.au3>
#include <GuiIPAddress.au3>

$softname = "TEST"

$main_GUI=GUICreate($SoftName, 500, 600)
$save=GUICtrlCreateButton("+", 250, 570, 30)
$exitbutton=GUICtrlCreateButton("Exit", 430, 570,60)

GUISetState(@SW_SHOW)

While 1
    $msg=GUIGetMsg()
    Select
        Case $msg=$save
            $line=save_IP()
            msgbox(0,"result","Name:"&$line[0]&" IP:"&$line[1]&" Mask:"&$line[2]&" Gateway:"&$line[3])
        Case $msg=$exitbutton
            iniWrite($INI, "interface", "default", GUICtrlRead($combo_interface))
            ExitLoop
        Case $msg=$GUI_EVENT_CLOSE
            iniWrite($INI, "interface", "default", GUICtrlRead($combo_interface))
            ExitLoop
    EndSelect
WEnd


Func Save_IP()
    $add_GUI=GUICreate($SoftName&" - Add Address", 600, 100)
    GUICtrlCreateLabel("Connection Name", 30, 10)
    $name=GUICtrlCreateInput("", 10, 35, 150)
    GUICtrlCreateLabel("IP", 230, 10)
    $IP=_GUICtrlIpAddress_Create($add_GUI, 170, 35)
    GUICtrlCreateLabel("NetMask", 350, 10)
    $Mask=_GUICtrlIpAddress_Create($add_GUI, 300, 35)
    GUICtrlCreateLabel("Gateway", 480, 10)
    $Gateway=_GUICtrlIpAddress_Create($add_GUI, 430, 35)
    $save=GUICtrlCreateButton("Save", 560, 35, 30)
    GUISetState(@SW_SHOW)
    While 1
        $msg=GUIGetMsg()
        Select
            Case $msg=$save
                if $Name AND $IP AND $Mask AND $Gateway Then
                    Dim $line[4]
                    $line[0]=$name
                    $line[1]=$IP
                    $line[2]=$Mask
                    $line[3]=$Gateway
                    Return($line)
                Else
                    msgbox(0,"Error","Missing Information")
                EndIf
            Case $msg=$GUI_EVENT_CLOSE
                Return
        EndSelect
    Wend
EndFunc
Edited by Syl21

Share this post


Link to post
Share on other sites
jfcby

Syl21,

FYI, first look in the help file for examples and then search this forum to see if someone has already ask a similar question. This is how I have found a lot of answers to my questions. Then if all possible post what you have already tried and tested with an example script prefered.

Check this link out and see if it is what yo are looking for... Click Here For Example Script!

jfcby


Determined -- Devoted -- Delivered Make your mind up -- to seriously apply yourself -- accomplishing the desired results. **** A soft answer turneth away wrath: but grievous words stir up anger. Proverbs 15:1 KJB ****

Share this post


Link to post
Share on other sites
Syl21

Syl21,

FYI, first look in the help file for examples and then search this forum to see if someone has already ask a similar question. This is how I have found a lot of answers to my questions. Then if all possible post what you have already tried and tested with an example script prefered.

Check this link out and see if it is what yo are looking for... Click Here For Example Script!

jfcby

Thx for your help, and sorry 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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.