Jump to content

switch hide/show guiLabel


silvano
 Share

Recommended Posts

hi,

can I switch and hide GUIlabel and GUIinput when I press on YES or NO radio button?

when I press YES label 2 hide and label 1 show... when I press NO label 1 hide nad label 2 show

sorry for my english...

this is the script

#include "_GUIConstants.au3"
$font="Verdana"
Func __yes()
GUICtrlCreateLabel ("label 1",  10,110,350,20)
GUICtrlSetFont (-1,10,$font)
$myInput = GUICtrlCreateInput ( "label 1", 30, 140, 200, 20 )
EndFunc

Func __no()
GUICtrlCreateLabel ("label 2",  10,180,350,40)
GUICtrlSetFont (-1,10,$font)
$myInput_2 = GUICtrlCreateInput ( "label 2", 30, 220, 200, 20 ) ;( "", 30, 220, 200, 20 )
EndFunc

GUICreate("SETTINGS",400,430,-1,-1);$WS_EX_TRANSPARENT

Dim $myInput, $myInput_2, $font

GUICtrlCreateLabel ("Select?",  10,10,350,20)
GUICtrlSetFont (-1,10,$font)
GUICtrlCreateGroup ("", 10, 30, 140, 60)
$radio_1 = GUICtrlCreateRadio ("YES", 30, 50, 50, 20)
$radio_2 = GUICtrlCreateRadio ("NO", 80, 50, 50, 20)
;GUICtrlSetState ($radio_2, $GUI_CHECKED)
$myGroupClose = GUICtrlCreateGroup ("",-99,-99,1,1)


GUISetState ()


While 1
    $msg = GUIGetMsg()
    If $msg = $radio_1 Then
        __yes()
    EndIf
    If $msg = $radio_2 Then
        __no()
        EndIf

    If $msg = $GUI_EVENT_CLOSE Then ExitLoop
        
Wend
Edited by silvano
Link to comment
Share on other sites

#include <GUIConstants.au3>

$font="Verdana"
GUICreate("SETTINGS",400,430,-1,-1);$WS_EX_TRANSPARENT

Dim $myInput, $myInput_2, $font

GUICtrlCreateLabel ("Select?",  10,10,350,20)
GUICtrlSetFont (-1,10,$font)
GUICtrlCreateGroup ("", 10, 30, 140, 60)
$radio_1 = GUICtrlCreateRadio ("YES", 30, 50, 50, 20)
$radio_2 = GUICtrlCreateRadio ("NO", 80, 50, 50, 20)
;GUICtrlSetState ($radio_2, $GUI_CHECKED)
$label_1 = GUICtrlCreateLabel ("label 1",  10,110,350,20)
GUICtrlSetState(-1, $GUI_HIDE)
GUICtrlSetFont (-1,10,$font)
$myInput = GUICtrlCreateInput ( "label 1", 30, 140, 200, 20 )
GUICtrlSetState(-1, $GUI_HIDE)
$label_2 = GUICtrlCreateLabel ("label 2",  10,180,350,40)
GUICtrlSetState(-1, $GUI_HIDE)
GUICtrlSetFont (-1,10,$font)
$myInput_2 = GUICtrlCreateInput ( "label 2", 30, 220, 200, 20 ) ;( "", 30, 220, 200, 20 )
GUICtrlSetState(-1, $GUI_HIDE)
$myGroupClose = GUICtrlCreateGroup ("",-99,-99,1,1)



GUISetState ()


While 1
    $msg = GUIGetMsg()
    If $msg = $radio_1 Then
        GUICTRLSetState($label_1, $GUI_SHOW)
        GUIctrlSetState($myInput, $GUI_SHOW)
        GUIctrlSetState($label_2, $GUI_HIDE)
        GUIctrlSetState($myInput_2, $GUI_HIDE)
    EndIf
    If $msg = $radio_2 Then
        GUIctrlSetState($label_1, $GUI_HIDE)
        GUIctrlSetState($myInput, $GUI_HIDE)
        GUIctrlSetState($label_2, $GUI_SHOW)
        GUIctrlSetState($myInput_2, $GUI_SHOW)
        EndIf

    If $msg = $GUI_EVENT_CLOSE Then ExitLoop
        
Wend

Neo

[center][font="Arial"]--- The Neo and Only --- [/font][font="Arial"]--Projects---[/font]Image to Text converterText to ASCII converter[/center]

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