Jump to content
Sign in to follow this  
Orgins

GUIDelete question.

Recommended Posts

Orgins

I've got a main gui with a button that pops up a 2nd gui. The 2nd gui has a button when that button is pushed GUIDelete() is called and closes that 2nd gui out. But after that the first GUI is still there (which I want) and the button don't seem to work (which I don't want).

Should I be using something beside GUIdelete? if so which one?

Edited by Orgins

I'm a newbie.Sorry if I don't reposed to your replays very fast.

Share this post


Link to post
Share on other sites
Jos

Post a script showing your problem and we can help you quicker.

Why ... you can't help him without it ? guess you're loosing your powers ... :) Edited by JdeB

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites
GaryFrost

Why ... you can't help him without it ? guess you're loosing your powers ... :D

Must of left them over in Holland.... :)


SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Share this post


Link to post
Share on other sites
Orgins

When I click set timer and then done on the 2nd gui the first gui buttons won't work anymore.

Its more or less this (striped out most of the code):

#include <GUIConstants.au3>
#include <IE.au3>

Global $Paused
HotKeySet("{PAUSE}", "TogglePause")
HotKeySet("{ESC}", "Terminate")

GUICreate("Gui1", 400, 280, 250, 156)
$Pic1 = GUICtrlCreatePic("pic.jpg", -8, -8, 450, 290, BitOR($SS_NOTIFY, $WS_GROUP, $WS_CLIPSIBLINGS))
GUICtrlSetState(-1, $GUI_DISABLE)



$MyButton1 = GUICtrlCreateButton("Start", 24, 216, 100, 30, $BS_FLAT)
$MyButton2 = GUICtrlCreateButton("Exit", 24, 248, 100, 30, $BS_FLAT)
$MyButton3 = GUICtrlCreateButton("Set timer", 128, 218, 100, 30, $BS_FLAT)

GUISetState(@SW_SHOW)


While 1
    $Msg = GUIGetMsg()
    Select
        Case $Msg = $GUI_EVENT_CLOSE
            ExitLoop
        Case $Msg = $MyButton1
            start()
        Case $Msg = $MyButton2
            Exit 0
        Case $Msg = $MyButton3
            Settimer()
    EndSelect
WEnd


Func start()
    
 

;Some code that I know works.

    

EndFunc   



Func Settimer()
GUICreate("Set timer", 194, 145, 363, 226)
$Pic1 = GUICtrlCreatePic("pic.jpg", -8, -8, 200, 250, BitOR($SS_NOTIFY, $WS_GROUP, $WS_CLIPSIBLINGS))
GUICtrlSetState(-1, $GUI_DISABLE)

$Input1d = GUICtrlCreateInput(IniRead("info.ini", "timer", "1", "1500"), 8, 40, 81, 21)
$Input2d = GUICtrlCreateInput(IniRead("info.ini", "timer", "2", "2500"), 104, 40, 81, 21)
$Input3d = GUICtrlCreateInput(IniRead("info.ini", "timer", "3", "2500"), 8, 80, 81, 21)
$Input4d = GUICtrlCreateInput(IniRead("info.ini", "timer", "4", "3500"), 104, 80, 81, 21)

$Delay = GUICtrlCreateLabel("timer 1 min", 8, 24, 91, 17)

$Label1d = GUICtrlCreateLabel("max", 104, 24, 56, 17)

$Label2d = GUICtrlCreateLabel("timer 2 min", 8, 64, 96, 17)

$Label3d = GUICtrlCreateLabel("max", 104, 64, 96, 17)



$Done = GUICtrlCreateButton("Done", 48, 104, 100, 30, $BS_FLAT)
GUISetState(@SW_SHOW)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $Done 
    $Delay1 = GUICtrlRead($Input1d)
    $Delay2 = GUICtrlRead($Input2d)
    $Delay3 = GUICtrlRead($Input3d)
    $Delay4 = GUICtrlRead($Input4d)

    IniWrite("info.ini", "timer", "1", $Delay1)
    IniWrite("info.ini", "timer", "2", $Delay2)
    IniWrite("info.ini", "timer", "3", $Delay3)
    IniWrite("info.ini", "timer", "4", $Delay4)
    GUIDelete()  ; This is where I'm stuck. It kills the 2nd gui and the first one buttons stop working
    EndSwitch
WEnd
EndFunc

Func TogglePause()
    $Paused = Not $Paused
    While $Paused
        Sleep(500)
        ToolTip("script is paused", 0, 0)
    WEnd
    ToolTip("")
EndFunc   


Func Terminate()
    Exit 0
EndFunc
Edited by Orgins

I'm a newbie.Sorry if I don't reposed to your replays very fast.

Share this post


Link to post
Share on other sites
GaryFrost

You weren't exiting the loop

#include <GUIConstants.au3>
#include <IE.au3>

Global $Paused
HotKeySet("{PAUSE}", "TogglePause")
HotKeySet("{ESC}", "Terminate")

GUICreate("Gui1", 400, 280, 250, 156)
$Pic1 = GUICtrlCreatePic("pic.jpg", -8, -8, 450, 290, BitOR($SS_NOTIFY, $WS_GROUP, $WS_CLIPSIBLINGS))
GUICtrlSetState(-1, $GUI_DISABLE)



$MyButton1 = GUICtrlCreateButton("Start", 24, 216, 100, 30, $BS_FLAT)
$MyButton2 = GUICtrlCreateButton("Exit", 24, 248, 100, 30, $BS_FLAT)
$MyButton3 = GUICtrlCreateButton("Set timer", 128, 218, 100, 30, $BS_FLAT)

GUISetState(@SW_SHOW)


While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            ExitLoop
        Case $MyButton1
            start()
        Case $MyButton2
            Exit 0
        Case $MyButton3
            Settimer()
    EndSwitch
WEnd


Func start()

    While 1

        ;Some code that I know works.

    WEnd

EndFunc   ;==>start



Func Settimer()
    $GUI_Timer = GUICreate("Set timer", 194, 145, 363, 226)
    $Pic1 = GUICtrlCreatePic("pic.jpg", -8, -8, 200, 250, BitOR($SS_NOTIFY, $WS_GROUP, $WS_CLIPSIBLINGS))
    GUICtrlSetState(-1, $GUI_DISABLE)

    $Input1d = GUICtrlCreateInput(IniRead("info.ini", "timer", "1", "1500"), 8, 40, 81, 21)
    $Input2d = GUICtrlCreateInput(IniRead("info.ini", "timer", "2", "2500"), 104, 40, 81, 21)
    $Input3d = GUICtrlCreateInput(IniRead("info.ini", "timer", "3", "2500"), 8, 80, 81, 21)
    $Input4d = GUICtrlCreateInput(IniRead("info.ini", "timer", "4", "3500"), 104, 80, 81, 21)

    $Delay = GUICtrlCreateLabel("timer 1 min", 8, 24, 91, 17)

    $Label1d = GUICtrlCreateLabel("max", 104, 24, 56, 17)

    $Label2d = GUICtrlCreateLabel("timer 2 min", 8, 64, 96, 17)

    $Label3d = GUICtrlCreateLabel("max", 104, 64, 96, 17)



    $Done = GUICtrlCreateButton("Done", 48, 104, 100, 30, $BS_FLAT)
    GUISetState(@SW_SHOW)

    While 1
        Switch GUIGetMsg()
            Case $Done
                $Delay1 = GUICtrlRead($Input1d)
                $Delay2 = GUICtrlRead($Input2d)
                $Delay3 = GUICtrlRead($Input3d)
                $Delay4 = GUICtrlRead($Input4d)

                IniWrite("info.ini", "timer", "1", $Delay1)
                IniWrite("info.ini", "timer", "2", $Delay2)
                IniWrite("info.ini", "timer", "3", $Delay3)
                IniWrite("info.ini", "timer", "4", $Delay4)
                GUIDelete($GUI_Timer)  ; This is where I'm stuck. It kills the 2nd gui and the first one buttons stop working
                ExitLoop
        EndSwitch
    WEnd
EndFunc   ;==>Settimer

Func TogglePause()
    $Paused = Not $Paused
    While $Paused
        Sleep(500)
        ToolTip("script is paused", 0, 0)
    WEnd
    ToolTip("")
EndFunc   ;==>TogglePause


Func Terminate()
    Exit 0
EndFunc   ;==>Terminate

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

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  

×