Jump to content

Notebook control in another tab page.


JRowe
 Share

Recommended Posts

Pretty basic, I think, and I'm trying to use the UDF tabs to get a Tabsheet/Notebook control inside another tab page. Koda can't do it, but I think I'm making progress.

Anyway, if someone could poke around and maybe show me how to attach $hTab_2 to a single page in $hTab_1, that would rock :P

#include <GuiConstants.au3>
#include <GuiConstantsEx.au3>
#include <GuiTab.au3>
#include <WindowsConstants.au3>

Opt("GuiOnEventMode", 1)

$hGUI = GUICreate("Test", 640, 480)
GUISetOnEvent($GUI_EVENT_CLOSE, "_Quit")


$hTab_1 = _GUICtrlTab_Create($hGUI, 20, 20, 290, 390)
$IdxTabItem_1_0 = _GUICtrlTab_InsertItem($hTab_1, 0,"Tab 1-0")
$IdxTabItem_1_1 = _GUICtrlTab_InsertItem($hTab_1, 1, "Tab 1-1")


$hTab_2 = _GUICtrlTab_Create($hTab_1, 30, 30, 160, 160)
$IdxTabItem_2_0 = _GUICtrlTab_InsertItem($hTab_2, 0, "Tab 2-0")
$IdxTabItem_2_1 = _GUICtrlTab_InsertItem($hTab_2, 1, "Tab 2-1")

$hTab_3 = _GUICtrlTab_Create($hGUI, 330, 220, 160, 160)
$IdxTabItem_3_0 = _GUICtrlTab_InsertItem($hTab_3, 0,"Tab 1-0")
$IdxTabItem_3_1 = _GUICtrlTab_InsertItem($hTab_3, 1, "Tab 1-1")

GUISetState()


While 1
    Sleep(20)
WEnd

Func _Quit()
    Exit
EndFunc
Edited by Jrowe
Link to comment
Share on other sites

You can only have 1 tab in a gui.

Here is a much-referred-to post which gives a work-around.

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
Share on other sites

Excellent, thank you.

CODE
; Example of TAB in TAB ctrl

#include <GUIConstants.au3>

Global $main_GUI,$ok_button,$cancel_button

; This window has 2 ok/cancel-buttons

$main_GUI = GUICreate("TAB in TAB",260,250,-1,-1)

$ok_button = GUICtrlCreateButton("OK",40,220,70,20)

$cancel_button = GUICtrlCreateButton("Cancel",150,220,70,20)

; Create the first child window that is implemented into the main GUI

$child1 = GUICreate("",230,170,15,35,BitOr($WS_CHILD,$WS_TABSTOP),-1,$main_GUI)

$child_tab = GUICtrlCreateTab(10,10,210,150)

$child11tab = GUICtrlCreateTabItem("1")

$child12tab = GUICtrlCreateTabItem("2")

GUICtrlCreateTabItem("")

GUISetState()

; Create the second child window that is implemented into the main GUI

$child2 = GUICreate("",230,170,15,35,BitOr($WS_CHILD,$WS_TABSTOP),-1,$main_GUI)

$listview2 = GUICtrlCreateListView("Col1|Col2",10,10,210,150,-1,$WS_EX_CLIENTEDGE)

GUICtrlCreateListViewItem("ItemLong1|ItemLong12", $listview2)

GUICtrlCreateListViewItem("ItemLong2|Item22", $listview2)

; Switch back the main GUI and create the tabs

GUISwitch($main_GUI)

$main_tab = GUICtrlCreateTab(10,10,240,200)

$child1tab = GUICtrlCreateTabItem("Child1")

$child2tab = GUICtrlCreateTabItem("Child2")

GUICtrlCreateTabItem("")

GUISetState()

While 1

$msg = GUIGetMsg(1)

Switch $msg[0]

Case $GUI_EVENT_CLOSE, $cancel_button

ExitLoop

Case $main_tab

Switch GUICtrlRead($main_tab)

Case 0

GUISetState(@SW_HIDE,$child2)

GUISetState(@SW_SHOW,$child1)

Case 1

GUISetState(@SW_HIDE,$child1)

GUISetState(@SW_SHOW,$child2)

EndSwitch

EndSwitch

WEnd

CODE
; Example of multiple tabs in the same GUI

#include <GUIConstants.au3>

DIM $main_GUI,$ok_button,$cancel_button

; The main GUI window has the 2 ok/cancel-buttons and two child GUIs

$main_GUI = GUICreate("Multiple TABs",520,250,-1,-1,BitOr($GUI_SS_DEFAULT_GUI,$WS_CLIPSIBLINGS))

$ok_button = GUICtrlCreateButton("OK",40,220,70,20)

$cancel_button = GUICtrlCreateButton("Cancel",150,220,70,20)

GUISetState()

; Creates the first child GUI window as a child of main GUI

$child1 = GUICreate("",230,170,15,35,BitOr($WS_CHILD,$WS_TABSTOP),-1,$main_GUI)

$child_tab = GUICtrlCreateTab(10,10,210,150)

$child11tab = GUICtrlCreateTabItem("1")

$child12tab = GUICtrlCreateTabItem("2")

GUICtrlCreateTabItem("")

GUISetState()

; Creates the second gui window as a child of main GUI

$child2 = GUICreate("",230,170,250,35,BitOr($WS_CHILD,$WS_TABSTOP),-1,$main_GUI)

; Create second TAB control and its the tabs

$main_tab = GUICtrlCreateTab(10,10,220,150)

$child1tab = GUICtrlCreateTabItem("Child1")

$child2tab = GUICtrlCreateTabItem("Child2")

GUICtrlCreateTabItem("")

GUICtrlSetState($child1tab,$GUI_SHOW)

GUISetState()

GUISwitch($main_GUI)

While 1

$msg = GUIGetMsg(1)

Switch $msg[0]

Case $GUI_EVENT_CLOSE, $cancel_button

ExitLoop

Case $main_tab

Switch GUICtrlRead($main_tab)

Case 0

Case 1

EndSwitch

EndSwitch

WEnd

For future searches:

Multiple Tabs

Multiple Notebook

Tab in Notebook

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