Jump to content

GUI button doesn't work?


InsiDer
 Share

Recommended Posts

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.

 

Link to comment
Share on other sites

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
Link to comment
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.

 

Link to comment
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

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...