Sign in to follow this  
Followers 0
MadBoy

GUI Creation with Tabs

3 posts in this topic

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)

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

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

Share this post


Link to post
Share on other sites

Yeah, I was only missing the GUISwitch :) Rest was clear.

Thanks muchos. As always great forum you can always count on!


My little company: Evotec (PL version: Evotec)

Share this post


Link to post
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
Sign in to follow this  
Followers 0