Navigation -> neuer Content

  • hallo

    ich habe mal ein test script erstellt..

    ich möchte ,wenn man auf den button drückt nen neuer content erstellt wird.. habe ich auch.. ABER wenn ich auf nen andern buttton drücke soll der alte gelöscht werden und der content von button2 dort stehen..

    hier mal das script:

    [autoit]

    #include <ButtonConstants.au3>
    #include <GUIConstantsEx.au3>
    #include <StaticConstants.au3>
    #include <WindowsConstants.au3>
    #Region ### START Koda GUI section ### Form=
    $Form1 = GUICreate("Form1", 472, 162, 192, 124)
    $Button1 = GUICtrlCreateButton("Button1", 16, 16, 75, 25, $WS_GROUP)
    $Button2 = GUICtrlCreateButton("Button2", 16, 56, 75, 25, $WS_GROUP)
    $Button3 = GUICtrlCreateButton("Button3", 16, 88, 75, 25, $WS_GROUP)
    $Button4 = GUICtrlCreateButton("Button4", 16, 128, 75, 25, $WS_GROUP)
    $Group1 = GUICtrlCreateGroup("", 104, 8, 9, 153)
    GUICtrlCreateGroup("", -99, -99, 1, 1)
    GUISetState(@SW_SHOW)
    #EndRegion ### END Koda GUI section ###

    [/autoit][autoit][/autoit][autoit]

    While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $GUI_EVENT_CLOSE
    Exit
    Case $Button1
    $Group2 = GUICtrlCreateGroup("Group2", 128, 8, 233, 153)
    $Edit1 = GUICtrlCreateEdit("", 152, 32, 185, 89)
    GUICtrlSetData(-1, "Edit1")
    GUICtrlCreateGroup("", -99, -99, 1, 1)
    Case $Button2
    $Group2 = GUICtrlCreateGroup("Group3", 128, 8, 233, 153)
    $Button5 = GUICtrlCreateButton("Button5", 144, 40, 75, 25, $WS_GROUP)
    $Checkbox1 = GUICtrlCreateCheckbox("Checkbox1", 272, 56, 97, 17)
    $Combo1 = GUICtrlCreateCombo("Combo1", 176, 96, 145, 25)
    GUICtrlCreateGroup("", -99, -99, 1, 1)

    [/autoit][autoit][/autoit][autoit][/autoit][autoit]

    EndSwitch
    WEnd

    [/autoit]

    danke

    Einmal editiert, zuletzt von MysticSun (23. Oktober 2009 um 16:51)

  • Ich würde die alle beim GUI aufbau definieren und dann mit GUICtrlSetstate(..,$GUI_HIDE) und GUICtrlSetState(....,$GUI_SHOW) arbeiten... ungefähr so:

    Spoiler anzeigen
    [autoit]

    #include <ButtonConstants.au3>
    #include <GUIConstantsEx.au3>
    #include <StaticConstants.au3>
    #include <WindowsConstants.au3>
    #Region ### START Koda GUI section ### Form=
    $Form1 = GUICreate("Form1", 472, 162, 192, 124)
    $Button1 = GUICtrlCreateButton("Button1", 16, 16, 75, 25, $WS_GROUP)
    $Button2 = GUICtrlCreateButton("Button2", 16, 56, 75, 25, $WS_GROUP)
    $Button3 = GUICtrlCreateButton("Button3", 16, 88, 75, 25, $WS_GROUP)
    $Button4 = GUICtrlCreateButton("Button4", 16, 128, 75, 25, $WS_GROUP)
    $Group1 = GUICtrlCreateGroup("", 104, 8, 9, 153)
    GUICtrlCreateGroup("", -99, -99, 1, 1)

    [/autoit] [autoit][/autoit] [autoit]

    ;Group2 Start
    $Group2 = GUICtrlCreateGroup("Group2", 128, 8, 233, 153)
    $Edit1 = GUICtrlCreateEdit("", 152, 32, 185, 89)
    GUICtrlSetData(-1, "Edit1")
    GUICtrlCreateGroup("", -99, -99, 1, 1)
    ;Group 2 Ende

    [/autoit] [autoit][/autoit] [autoit]

    ;Group 3 Start
    $Group3 = GUICtrlCreateGroup("Group3", 128, 8, 233, 153)
    $Button5 = GUICtrlCreateButton("Button5", 144, 40, 75, 25, $WS_GROUP)
    $Checkbox1 = GUICtrlCreateCheckbox("Checkbox1", 272, 56, 97, 17)
    $Combo1 = GUICtrlCreateCombo("Combo1", 176, 96, 145, 25)
    GUICtrlCreateGroup("", -99, -99, 1, 1)
    ;Group 3 Ende

    [/autoit] [autoit][/autoit] [autoit]

    #EndRegion ### END Koda GUI section ###

    [/autoit] [autoit][/autoit] [autoit]

    GUICtrlSetState($Group2,$GUI_HIDE)
    GUICtrlSetState($Group3,$GUI_HIDE)
    GUICtrlSetState($Edit1,$GUI_HIDE)
    GUICtrlSetState($Button5,$GUI_HIDE)
    GUICtrlSetState($Checkbox1,$GUI_HIDE)
    GUICtrlSetState($Combo1,$GUI_HIDE)

    [/autoit] [autoit][/autoit] [autoit]

    GUISetState(@SW_SHOW)
    While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $GUI_EVENT_CLOSE
    Exit
    Case $Button1
    GUICtrlSetState($Button5,$GUI_HIDE)
    GUICtrlSetState($Checkbox1,$GUI_HIDE)
    GUICtrlSetState($Combo1,$GUI_HIDE)
    GUICtrlSetState($Group3,$GUI_HIDE)
    ;versteckt alles andere

    [/autoit] [autoit][/autoit] [autoit]

    GUICtrlSetState($Group2,$GUI_SHOW)
    GUICtrlSetState($Edit1,$GUI_SHOW)
    ;Zeigt die Controls an
    Case $Button2
    GUICtrlSetState($Group2,$GUI_HIDE)
    GUICtrlSetState($Edit1,$GUI_HIDE)
    ;versteckt alles andere

    [/autoit] [autoit][/autoit] [autoit]

    GUICtrlSetState($Button5,$GUI_SHOW)
    GUICtrlSetState($Checkbox1,$GUI_SHOW)
    GUICtrlSetState($Combo1,$GUI_SHOW)
    GUICtrlSetState($Group3,$GUI_SHOW)

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    EndSwitch
    WEnd

    [/autoit]
  • Naja dann versteckst du die vom 3ten halt auch.
    Das ganze wird aber ab nem gewissen punkt sehr aufwendig und unübersichtlich. Eine sicherlich "sauberere" methode wäre es für die einzelnen Groups die du haben willst Child GUIs zu erstellen und die ein / auszublenden ... also so:

    Spoiler anzeigen
    [autoit]

    #include <ButtonConstants.au3>
    #include <GUIConstantsEx.au3>
    #include <StaticConstants.au3>
    #include <WindowsConstants.au3>
    #Region ### START Koda GUI section ### Form=
    $Form1 = GUICreate("Form1", 472, 162, 192, 124)
    $Button1 = GUICtrlCreateButton("Button1", 16, 16, 75, 25, $WS_GROUP)
    $Button2 = GUICtrlCreateButton("Button2", 16, 56, 75, 25, $WS_GROUP)
    $Button3 = GUICtrlCreateButton("Button3", 16, 88, 75, 25, $WS_GROUP)
    $Button4 = GUICtrlCreateButton("Button4", 16, 128, 75, 25, $WS_GROUP)
    $Group1 = GUICtrlCreateGroup("", 104, 8, 9, 153)
    GUICtrlCreateGroup("", -99, -99, 1, 1)

    [/autoit] [autoit][/autoit] [autoit]

    ;ChildGUI 1 Start
    $ChildGUI1 = GUICreate("",472,160,0,0,$WS_CHILD,$WS_EX_TOOLWINDOW,$Form1)
    $Group2 = GUICtrlCreateGroup("Group2", 128, 8, 233, 153)
    $Edit1 = GUICtrlCreateEdit("", 152, 32, 185, 89)
    GUICtrlSetData(-1, "Edit1")
    GUICtrlCreateGroup("", -99, -99, 1, 1)
    ;ChildGUI 1 Ende

    [/autoit] [autoit][/autoit] [autoit]

    ;ChildGUI 2 Start
    $ChildGUI2 = GUICreate("",472,160,0,0,$WS_CHILD,$WS_EX_TOOLWINDOW,$Form1)
    $Group3 = GUICtrlCreateGroup("Group3", 128, 8, 233, 153)
    $Button5 = GUICtrlCreateButton("Button5", 144, 40, 75, 25, $WS_GROUP)
    $Checkbox1 = GUICtrlCreateCheckbox("Checkbox1", 272, 56, 97, 17)
    $Combo1 = GUICtrlCreateCombo("Combo1", 176, 96, 145, 25)
    GUICtrlCreateGroup("", -99, -99, 1, 1)
    ;ChildGUI 2 Start

    [/autoit] [autoit][/autoit] [autoit]

    ;ChildGUI 3 Start
    $ChildGUI3 = GUICreate("",472,160,0,0,$WS_CHILD,$WS_EX_TOOLWINDOW,$Form1)
    $Group4 = GUICtrlCreateGroup("Group4", 128, 8, 233, 153)
    $Button6 = GUICtrlCreateButton("Button6", 144, 40, 75, 25, $WS_GROUP)
    $Label1 = GUICtrlCreateLabel("Label1",144, 80, 70, 30)
    GUICtrlCreateGroup("", -99, -99, 1, 1)
    ;ChildGUI 3 Start

    [/autoit] [autoit][/autoit] [autoit]

    #EndRegion ### END Koda GUI section ###

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    GUISwitch($Form1)
    GUISetState(@SW_SHOW)
    While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $GUI_EVENT_CLOSE
    Exit
    Case $Button1
    GUISetState(@SW_SHOW,$ChildGUI1)

    GUISetState(@SW_HIDE,$ChildGUI2)
    GUISetState(@SW_HIDE,$ChildGUI3)

    [/autoit] [autoit][/autoit] [autoit]

    Case $Button2

    GUISetState(@SW_SHOW,$ChildGUI2)

    [/autoit] [autoit][/autoit] [autoit]

    GUISetState(@SW_HIDE,$ChildGUI1)
    GUISetState(@SW_HIDE,$ChildGUI3)

    [/autoit] [autoit][/autoit] [autoit]

    Case $Button3

    GUISetState(@SW_SHOW,$ChildGUI3)

    [/autoit] [autoit][/autoit] [autoit]

    GUISetState(@SW_HIDE,$ChildGUI1)
    GUISetState(@SW_HIDE,$ChildGUI2)

    EndSwitch
    WEnd

    [/autoit]
  • Hallo MyticSun,

    üblicherweise benutzt man dazu ein TabControl:

    Spoiler anzeigen
    [autoit]

    #include <ButtonConstants.au3>
    #include <GUIConstantsEx.au3>
    #include <StaticConstants.au3>
    #include <WindowsConstants.au3>
    #include <TabConstants.au3>

    [/autoit] [autoit][/autoit] [autoit]

    #Region ### START Koda GUI section ### Form=
    $Form1 = GUICreate("Form1", 472, 162, 192, 124)
    GUICtrlCreateTab(5, 5, 462, 152);, BitOR($TCS_FLATBUTTONS,$TCS_VERTICAL ))
    GUICtrlCreateTabItem("1. Tab")
    $Group2 = GUICtrlCreateGroup("Group2", 28, 38, 233, 153)
    $Edit1 = GUICtrlCreateEdit("", 52, 62, 185, 89)
    GUICtrlSetData(-1, "Edit1")
    GUICtrlCreateGroup("", -99, -99, 1, 1)
    GUICtrlCreateTabItem("2. Tab")
    $Group2 = GUICtrlCreateGroup("Group3", 128, 38, 233, 153)
    $Button5 = GUICtrlCreateButton("Button5", 144, 60, 75, 25, $WS_GROUP)
    $Checkbox1 = GUICtrlCreateCheckbox("Checkbox1", 272, 76, 97, 17)
    $Combo1 = GUICtrlCreateCombo("Combo1", 176, 116, 145, 25)
    GUICtrlCreateTabItem("3. Tab")
    GUICtrlCreateTabItem(""); Beendet die Tab Definition

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    GUISetState(@SW_SHOW)
    #EndRegion ### END Koda GUI section ###

    [/autoit] [autoit][/autoit] [autoit]

    While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $GUI_EVENT_CLOSE
    Exit

    [/autoit] [autoit][/autoit] [autoit]

    EndSwitch
    WEnd

    [/autoit]

    mfg (Auto)Bert