Sign in to follow this  
Followers 0
InsiDer

GUI button doesn't work?

8 posts in this topic

Here's the issue: In my GUI (parent), a button opens a child, but after closing the child and returning to the parent, the button won't re-open the child? What may cause this?

Share this post


Link to post
Share on other sites



Here's the issue: In my GUI (parent), a button opens a child, but after closing the child and returning to the parent, the button won't re-open the child? What may cause this?

The Moon being on the far side of the Sun.

Hard to help with-out code to look at.


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

#3 ·  Posted (edited)

Oh don't be silly :P

#include <GUIConstants.au3>
#include <XSkin.au3>
$Skin_Folder = @ScriptDir & "\Skins\Red-Black"
Dim $show = 0, $Child_[3], $children = 2

$XSkinGUI = XSkinGUICreate("x", 500, 500, $Skin_Folder)                    
GUISetFont(14, 400, 4)
$Button_2 = GUICtrlCreateButton("W", 60, 250, 170, 30)
$Button_1 = GUICtrlCreateButton("W", 60, 300, 170, 30)
$filemenu = GuiCtrlCreateMenu ("File")
$exititem = GuiCtrlCreateMenuitem ("Exit",$filemenu)
GUISetState() 

$Child_[1] = XSkinGUICreate("S", 400, 400, $Skin_Folder)
$Button_15 = GUICtrlCreateButton ("Hide", 160, 310, 80, 30) 
GUISetState(@SW_HIDE)

$Child_[2] = XSkinGUICreate("W", 400, 400, $Skin_Folder)
$Button_21 = GUICtrlCreateButton ("Hide", 160, 310, 80, 30) 
GUISetState(@SW_HIDE)

While 1
    $msg = GUIGetMsg()
    
    If $msg = $GUI_EVENT_CLOSE Then ExitLoop


If $msg = $Button_1 Then GuiSetState( @SW_SHOW, $child_[1])
If $msg = $Button_2 Then GuiSetState( @SW_SHOW, $child_[2])
            If $msg = $Button_15 Then GUIDelete($child_[1])
            If $msg = $Button_21 Then GUIDelete($child_[2]) 
                      
            Select
                    Case $msg = $exititem
            ExitLoop
EndSelect
wend

What am I missing?

Edited by InsiDer

Share this post


Link to post
Share on other sites

Not tested, don't have the skin files here at work.

you used GuiDelete instead of GuiSetState

#include <GUIConstants.au3>
#include <XSkin.au3>
$Skin_Folder = @ScriptDir & "\Skins\Red-Black"
Dim $show = 0, $Child_[3], $children = 2

$XSkinGUI = XSkinGUICreate ("x", 500, 500, $Skin_Folder)
GUISetFont(14, 400, 4)
$Button_2 = GUICtrlCreateButton("W", 60, 250, 170, 30)
$Button_1 = GUICtrlCreateButton("W", 60, 300, 170, 30)
$filemenu = GUICtrlCreateMenu("File")
$exititem = GUICtrlCreateMenuitem("Exit", $filemenu)
GUISetState()

$Child_[1] = XSkinGUICreate ("S", 400, 400, $Skin_Folder)
$Button_15 = GUICtrlCreateButton("Hide", 160, 310, 80, 30)
GUISetState(@SW_HIDE)

$Child_[2] = XSkinGUICreate ("W", 400, 400, $Skin_Folder)
$Button_21 = GUICtrlCreateButton("Hide", 160, 310, 80, 30)
GUISetState(@SW_HIDE)

While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE, $exititem 
            ExitLoop
        Case $Button_1
            GUISetState(@SW_SHOW, $Child_[1])
        Case $Button_2 
            GUISetState(@SW_SHOW, $Child_[2])
        Case $Button_15
            GUISetState(@SW_HIDE, $Child_[1])
        Case $Button_21 
            GUISetState(@SW_HIDE, $Child_[2])
    EndSwitch
WEnd

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

Works like a charm, thank you very much. I appreciate it.

Share this post


Link to post
Share on other sites

might want to add

$Icon_Folder = @ScriptDir & "\Skins\Default" ; this


$XSkinGUI = XSkinGUICreate ("x", 500, 500, $Skin_Folder)
GUISetFont(14, 400, 4)
$XIcon = XSkinIcon($XSkinGui, 2) ;this

; and this

Switch GUIGetMsg()
        Case $XIcon[1]
            Exit
        Case $XIcon[2]
            GUISetState(@SW_MINIMIZE, $XSkinGUI)

oÝ÷ Û­Øb³*.q©ëzj/^jëh×6
$filemenu = GUICtrlCreateMenu("File")
$exititem = GUICtrlCreateMenuitem("Exit", $filemenu)

.... just a nicer visual

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites

As usual, Valuater steps in, shamelessly contributing considerably brilliant additions to ones application. Thank you :P

Share this post


Link to post
Share on other sites

Double dipping a really nice comment

thanks InsiDer

.... and thanks gafrost for the support

8)


NEWHeader1.png

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