Jump to content

GUI Creation with Tabs


 Share

Recommended Posts

Hello,

I have this problem. I've created GUI with 2 Tabs. In each tab i have diffrent gui labels, code boxes etc. I close Tab sections. Then somewhere below in the code i remove "label" or any other gui from Tab1 and want to create something else in it's place. Problem is when i use simple creation of gui i get this visible in both Tabs. Is it possible to somehow tell code to create the new gui into Tab 1?

$gui_tab[0] = GUICtrlCreateTab(5, 5, 524, 503)
$gui_tab[1] = GUICtrlCreateTabItem("Disk Imaging")
... some guis
$gui_tab[1] = GUICtrlCreateTabItem("Disk Wipe")
... some other guis
GUICtrlCreateTabItem("")   ; end tabitem definition


GuiCtrlDel ... from gui_tab[1]
GuiCtrlCreate in gui_tab[1]

My little company: Evotec (PL version: Evotec)

Link to comment
Share on other sites

Use GUISwitch($hWin,$tabitem)

Example:

#include <GUIConstants.au3>

$gui=GUICreate("", 340, 237, 188, 144)
$Tab1 = GUICtrlCreateTab(16, 8, 305, 225)
$TabSheet1 = GUICtrlCreateTabItem("Tab 1")
GUICtrlCreateLabel("Label 1", 112, 104, 39, 17)
$TabSheet2 = GUICtrlCreateTabItem("Tab 2")
GUICtrlCreateLabel("Label 2", 112, 104, 39, 17)
GUICtrlCreateTabItem("")
$butt=GUICtrlCreateButton("Button", 112,150, 39, 17)

GUISetState(@SW_SHOW)


While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        case $butt
            GUISwitch($gui,$TabSheet2)
            GUICtrlCreateLabel("Label 3", 112, 125, 39, 17)
            GUICtrlCreateTabItem("")
    EndSwitch
WEnd

Notice that I created the button after closing the tabitem creation with GUICtrlCreateTabItem("") which will make the button show in all the tabs. Pressing the button will create a label 3 in Tab 2.

Edited by Nahuel
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...