Jump to content

@SW_HIDE & @SW_SHOW Problems


Recommended Posts

I'm trying to get a GUI to be hidden when the user hits a specific button ($AFSelection) in a FileMenu Bar. I set the $selection to 0 when the user clicks it, and I have a function that hides all the GUIs when the $selection = 0. However, none of this is working, and the GUI isn't hidden and the other GUI isn't being shown.

While 1
    
    Selection()
    BackToSelection()
    
    
    $msg = GUIGetMsg()
    Select
        
    Case $msg = $AFSelection
        $selection = 0

        
    EndSelect   
    
Wend    

;
;
;

Func BackToSelection()
    If $selection = 0 Then
        GUISetState(@SW_HIDE, $AFGUI)
        GUISetState(@SW_HIDE, $PCGUI)
        GUISetState(@SW_HIDE, $PFGUI)
        GUISetState(@SW_HIDE, $HMGUI)
        GUISetState(@SW_SHOW, $SELECTGUI)
    EndIf   
EndFunc

Any help is greatly appreciated. =)

Link to comment
Share on other sites

#include <GUIConstants.au3>

#Region ;GLOBALS
Global $selection = 0
#EndRegion

;
;
;
#Region ;SELECTION GUI

$SELECTGUI = GUICreate("", 301, 186, 359, 202)
GUISetBkColor(0x000000)

$HMRadio = GUICtrlCreateRadio("", 162, 130, 15, 15)
$HMLabel = GUICtrlCreateLabel("", 177, 130, 95, 15)
GUICtrlSetFont(-1, 8, 400, 0, "@Arial Unicode MS")
GUICtrlSetColor(-1, 0xFFFFFF)
GUICtrlSetBkColor(-1, 0x0F0000)
GUISetState()

$PCRadio = GUICtrlCreateRadio("", 162, 110, 15, 15)
$PCLabel = GUICtrlCreateLabel("", 177, 110, 95, 15)
GUICtrlSetFont(-1, 8, 400, 0, "@Arial Unicode MS")
GUICtrlSetColor(-1, 0xFFFFFF)
GUICtrlSetBkColor(-1, 0x0F0000)
GUISetState()

$AFRadio = GUICtrlCreateRadio("", 52, 110, 15, 15)
$AFLabel = GUICtrlCreateLabel("", 67, 110, 95, 15)
GUICtrlSetFont(-1, 8, 400, 0, "@Arial Unicode MS")
GUICtrlSetColor(-1, 0xFFFFFF)
GUICtrlSetBkColor(-1, 0x0F0000)
GUISetState()


$PFRadio = GUICtrlCreateRadio("", 52, 130, 15, 15)
$PFLabel = GUICtrlCreateLabel("", 67, 130, 95, 15)
GUICtrlSetFont(-1, 8, 400, 0, "@Arial Unicode MS")
GUICtrlSetColor(-1, 0xFFFFFF)
GUICtrlSetBkColor(-1, 0x0F0000)
GUISetState()

$NextButton = GUICtrlCreateButton(">> Next >>", 104, 160, 75, 17, 0)


#EndRegion

#Region ;AF GUI

$AFGUI = GUICreate("AF", 266, 351, 359, 202)
GUISetFont(8, 400, 0, "@Arial Unicode MS")
GUISetBkColor(0x000000)

$AFMenuFile = GUICtrlCreateMenu("&File")
$AFMenuStart = GUICtrlCreateMenuItem("Start!", $AFMenuFile)
$AFMenuStop = GUICtrlCreateMenuItem("Stop", $AFMenuFile)
$AFSelection = GUICtrlCreateMenuItem("Selection Menu", $AFMenuFile)
$AFMenuPreferences = GUICtrlCreateMenuItem("Preferences", $AFMenuFile)
$AFMenuExit = GUICtrlCreateMenuItem("Exit", $AFMenuFile)


#EndRegion

;
;
;
#Region ;MAIN LOOP
While 1
    
    Selection()
    BackToSelection()
    
    
    $msg = GUIGetMsg()
    Select
        
    Case $msg = $AFSelection
        $selection = 0

        
    EndSelect   
    
Wend    
#EndRegion
;
;
;
#Region ;MAIN FUNCTIONS
Func BackToSelection()
    If $selection = 0 Then
        GUISetState(@SW_HIDE, $AFGUI)
        GUISetState(@SW_HIDE, $PCGUI)
        GUISetState(@SW_HIDE, $PFGUI)
        GUISetState(@SW_HIDE, $HMGUI)
        GUISetState(@SW_SHOW, $SELECTGUI)
    EndIf   
EndFunc 
#EndRegion
#Region ;SELECTION FUNCTIONS

Func Selection()
    While 1

    $msg = GUIGetMsg()
    Select
        
        Case $msg = $NextButton
        $username = GUICtrlRead($UsernameInput)
        $password = GUICtrlRead($PasswordInput)
        
        
        If $selection = 1 Then
        GUISetState(@SW_HIDE, $SELECTGUI)
        GUISetState(@SW_SHOW, $AFGUI)
        EndIf
        
        If $selection = 2 Then
        GUISetState(@SW_HIDE, $SELECTGUI)
        GUISetState(@SW_SHOW, $PCGUI)
        EndIf
        
        If $selection = 3 Then
        GUISetState(@SW_HIDE, $SELECTGUI)
        GUISetState(@SW_SHOW, $PFGUI)
        EndIf
        
        If $selection = 4 Then
        GUISetState(@SW_HIDE, $SELECTGUI)
        GUISetState(@SW_SHOW, $HMGUI)
        EndIf
        
        Case $msg = $AFRadio
            $selection = 1
            
        Case $msg = $PCRadio
            $selection = 2
            
        Case $msg = $PFRadio
            $selection = 3
            
        Case $msg = $HMRadio
            $selection = 4  

    EndSelect   
    Wend
EndFunc 

#EndRegion

#Region ;AF FUNCTIONS
Func AFSelectionMenu()
    $selection = 0
        GUISetState(@SW_HIDE, $AFGUI)
        GUISetState(@SW_SHOW, $SELECTGUI)   
EndFunc 
#EndRegion

Link to comment
Share on other sites

#include <GUIConstants.au3>

#Region ;GLOBALS
Global $selection = 0
#EndRegion

;
;
;
#Region ;SELECTION GUI

$SELECTGUI = GUICreate("", 301, 186, 359, 202)
GUISetBkColor(0x000000)

$HMRadio = GUICtrlCreateRadio("", 162, 130, 15, 15)
$HMLabel = GUICtrlCreateLabel("", 177, 130, 95, 15)
GUICtrlSetFont(-1, 8, 400, 0, "@Arial Unicode MS")
GUICtrlSetColor(-1, 0xFFFFFF)
GUICtrlSetBkColor(-1, 0x0F0000)
GUISetState()

$PCRadio = GUICtrlCreateRadio("", 162, 110, 15, 15)
$PCLabel = GUICtrlCreateLabel("", 177, 110, 95, 15)
GUICtrlSetFont(-1, 8, 400, 0, "@Arial Unicode MS")
GUICtrlSetColor(-1, 0xFFFFFF)
GUICtrlSetBkColor(-1, 0x0F0000)
GUISetState()

$AFRadio = GUICtrlCreateRadio("", 52, 110, 15, 15)
$AFLabel = GUICtrlCreateLabel("", 67, 110, 95, 15)
GUICtrlSetFont(-1, 8, 400, 0, "@Arial Unicode MS")
GUICtrlSetColor(-1, 0xFFFFFF)
GUICtrlSetBkColor(-1, 0x0F0000)
GUISetState()


$PFRadio = GUICtrlCreateRadio("", 52, 130, 15, 15)
$PFLabel = GUICtrlCreateLabel("", 67, 130, 95, 15)
GUICtrlSetFont(-1, 8, 400, 0, "@Arial Unicode MS")
GUICtrlSetColor(-1, 0xFFFFFF)
GUICtrlSetBkColor(-1, 0x0F0000)
GUISetState()

$NextButton = GUICtrlCreateButton(">> Next >>", 104, 160, 75, 17, 0)


#EndRegion

#Region ;AF GUI

$AFGUI = GUICreate("AF", 266, 351, 359, 202)
GUISetFont(8, 400, 0, "@Arial Unicode MS")
GUISetBkColor(0x000000)

$AFMenuFile = GUICtrlCreateMenu("&File")
$AFMenuStart = GUICtrlCreateMenuItem("Start!", $AFMenuFile)
$AFMenuStop = GUICtrlCreateMenuItem("Stop", $AFMenuFile)
$AFSelection = GUICtrlCreateMenuItem("Selection Menu", $AFMenuFile)
$AFMenuPreferences = GUICtrlCreateMenuItem("Preferences", $AFMenuFile)
$AFMenuExit = GUICtrlCreateMenuItem("Exit", $AFMenuFile)


#EndRegion

;
;
;
#Region ;MAIN LOOP
While 1
   
    Selection()
    BackToSelection()
   
   
    $msg = GUIGetMsg()
    Select
       
    Case $msg = $AFSelection
        $selection = 0

       
    EndSelect   
   
Wend   
#EndRegion
;
;
;
#Region ;MAIN FUNCTIONS
Func BackToSelection()
    If $selection = 0 Then
        GUISetState(@SW_HIDE, $AFGUI)
        ;GUISetState(@SW_HIDE, $PCGUI)
        ;GUISetState(@SW_HIDE, $PFGUI)
        ;GUISetState(@SW_HIDE, $HMGUI)
        GUISetState(@SW_SHOW, $SELECTGUI)
    EndIf   
EndFunc 
#EndRegion
#Region ;SELECTION FUNCTIONS

Func Selection()
    While 1

    $msg = GUIGetMsg()
    Select
       
        Case $msg = $NextButton
       ; $username = GUICtrlRead($UsernameInput)
       ; $password = GUICtrlRead($PasswordInput)
       
       
        If $selection = 1 Then
        GUISetState(@SW_HIDE, $SELECTGUI)
        GUISetState(@SW_SHOW, $AFGUI)
        EndIf
       
        If $selection = 2 Then
        GUISetState(@SW_HIDE, $SELECTGUI)
      ;  GUISetState(@SW_SHOW, $PCGUI)
        EndIf
       
        If $selection = 3 Then
        GUISetState(@SW_HIDE, $SELECTGUI)
     ;   GUISetState(@SW_SHOW, $PFGUI)
        EndIf
       
        If $selection = 4 Then
        GUISetState(@SW_HIDE, $SELECTGUI)
       ; GUISetState(@SW_SHOW, $HMGUI)
        EndIf
       
        Case $msg = $AFRadio
            $selection = 1
           
        Case $msg = $PCRadio
            $selection = 2
           
        Case $msg = $PFRadio
            $selection = 3
           
        Case $msg = $HMRadio
            $selection = 4 

    EndSelect   
    Wend
EndFunc 

#EndRegion

#Region ;AF FUNCTIONS
Func AFSelectionMenu()
    $selection = 0
        GUISetState(@SW_HIDE, $AFGUI)
        GUISetState(@SW_SHOW, $SELECTGUI)   
EndFunc 
#EndRegion

i just commented out some lines...(undeclared GUI's)

and it works... sortof

Edited by alexmadman

Only two things are infinite, the universe and human stupidity, and i'm not sure about the former -Alber EinsteinPractice makes perfect! but nobody's perfect so why practice at all?http://forum.ambrozie.ro

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...