Jump to content

Recommended Posts

Hi guys,

i have problem with this : 

2e0utk3.png

whheux.png

#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>


GUI()
Func GUI()
Global $MyForm = GUICreate("My GUI edit",500,300,100,100)
GUISetState(@SW_SHOW)
GUISetFont(12, 400, 0, "Tahoma")

$Label1 = GUICtrlCreateLabel("Label 01 ",0, 0, 50 , 25 )
$Label1 = GUICtrlCreateLabel("Label 01 ",0, 50, 50 , 25 )

Global $BTN1 = GUICtrlCreateButton("BTN 1 ", 150, 0, 50, 25)
Global $BTN2 = GUICtrlCreateButton("BTN 2", 150, 50, 50, 25)
EndFunc

;Function
Func Test1()
   If $BTN1 = True Then
   Local $Edit1 = GUICtrlCreateEdit("Edit 1", 0, 80, 200, 200)
   EndIf
EndFunc

Func Test2()
   If $BTN2 = True Then
   Local $Edit2 = GUICtrlCreateEdit("Edit 2", 200, 80, 200, 200)
   EndIf
EndFunc


While 1
Switch GUIGetMsg()

Case $BTN1
If $BTN1 = True Then
Test1 ()
EndIf

Case $BTN2
If $BTN2 = True Then
Test2 ()
EndIf

Case $GUI_EVENT_CLOSE
ExitLoop
EndSwitch
WEnd

* i want to : after click on "$BTN 1" , "$Edit2" was hidden or 

after click on "$BTN 2" , "$Edit1" was hidden.

Edited by zxtnt09
Image
Link to comment
Share on other sites

  • Moderators

zxtnt09,

Simple - just hide/show the edits as required:

#include <GUIConstantsEx.au3>

Global $MyForm, $BTN1, $BTN2, $Edit1, $Edit2

GUI()

While 1
    Switch GUIGetMsg()
        Case $BTN1
            GUICtrlSetState($Edit2, $GUI_HIDE)
            GUICtrlSetState($Edit1, $GUI_SHOW)
        Case $BTN2
            GUICtrlSetState($Edit1, $GUI_HIDE)
            GUICtrlSetState($Edit2, $GUI_SHOW)
        Case $GUI_EVENT_CLOSE
            ExitLoop

    EndSwitch

WEnd



Func GUI()
    $MyForm = GUICreate("My GUI edit", 500, 300, 100, 100)

    GUISetFont(12, 400, 0, "Tahoma")

    $Label1 = GUICtrlCreateLabel("Label 01 ", 0, 0, 50, 25)
    $Label1 = GUICtrlCreateLabel("Label 01 ", 0, 50, 50, 25)

    $BTN1 = GUICtrlCreateButton("BTN 1 ", 150, 0, 50, 25)
    $BTN2 = GUICtrlCreateButton("BTN 2", 150, 50, 50, 25)

    $Edit1 = GUICtrlCreateEdit("Edit 1", 0, 80, 200, 200)
    $Edit2 = GUICtrlCreateEdit("Edit 2", 200, 80, 200, 200)
    GUICtrlSetState($Edit2, $GUI_HIDE)

    GUISetState(@SW_SHOW)
EndFunc   ;==>GUI

And it is not good coding practice to declare Global variables inside functions - so I changed that too.

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

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

×
×
  • Create New...