Jump to content

Tabs in Tabs


GEOSoft
 Share

Recommended Posts

This is just a concept of how this can be done using Child Windows. It is buggy as it comes and I suspect that it may need some GUISwitch()ing done. Sometimes it works as expected and sometimes you have to play around clicking the outer tabs to get it to switch. I really don't have the time right now to go further with this so if anyone wants to pick it up then fly at it. I only request that modifications are posted in this thread.

Edit: Code removed, See ReFrans example for functional code.

http://www.autoitscript.com/forum/index.php?showtopic=63489&view=findpost&p=473877

Edited by GEOSoft

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Link to comment
Share on other sites

Hi! Interesting example, but have a bug, if i quick click on main tabs, then child tabs not displayed correct.

Posted Image

P.S. Sorry for bad english.

And I said sometimes you have to play around with clicking those outer tabs to get them to change. That's why I posted it as a concept only. I also said that it was a bit buggy and you just discovered the bug. Since we can't do Tab in Tab using the AutoIt GUI, I was looking at a work-around.

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Link to comment
Share on other sites

Hi,

; 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

Mega

Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Link to comment
Share on other sites

Hi,

; 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

Mega

Good work. I knew somebody would run with the concept. Now all I have to do is eliminate those damn constants. Then I'll file it away for future reference.

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Link to comment
Share on other sites

Good work.

Yeah,

I think it goes back on a concept from valuater.

However, you can increase it, if you put the tab switch into a function, so you can call it also from other functions.

Best regards, Reinhard

; 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("")

DIM $tabItemLast = 0

GUISetState()

While 1
    $msg = GUIGetMsg(1)
    Switch $msg[0]
        Case $GUI_EVENT_CLOSE, $cancel_button
            ExitLoop
            
        Case $main_tab
            $tabItem = GUICtrlRead($main_Tab)
             if $tabItem <> $tabItemLast then TabSwitch($tabItem)
            
    EndSwitch
WEnd

func TabSwitch($tabItem)
    GUISetState(@SW_HIDE,$child1)
    GUISetState(@SW_HIDE,$child2)
    
        
    if $tabItem = 0 then GUISetState(@SW_SHOW,$child1)
    if $tabItem = 1 then GUISetState(@SW_SHOW,$child2)
    
   $tabItemLast = $tabItem
EndFunc
Edited by ReFran
Link to comment
Share on other sites

I have also a question to it.

Can the attached code of a tab switch be written shorter,

using assign, eval, ..... or what else?

br, Reinhard

func TabSwitch($tabItem)
    GUISetState(@SW_HIDE,$tab1GUI)
    GUISetState(@SW_HIDE,$tab2GUI)
    GUISetState(@SW_HIDE,$tab3GUI)
    GUISetState(@SW_HIDE,$tab4GUI)
    GUISetState(@SW_HIDE,$tab5GUI)
    GUISetState(@SW_HIDE,$tab6GUI)
    GUISetState(@SW_HIDE,$tab7GUI)
        
    if $tabItem = 0 then GUISetState(@SW_SHOW,$tab1GUI)
    if $tabItem = 1 then GUISetState(@SW_SHOW,$tab2GUI)
    if $tabItem = 2 then GUISetState(@SW_SHOW,$tab3GUI)
    if $tabItem = 3 then GUISetState(@SW_SHOW,$tab4GUI)
    if $tabItem = 4 then GUISetState(@SW_SHOW,$tab5GUI)
    if $tabItem = 5 then GUISetState(@SW_SHOW,$tab6GUI)     
    if $tabItem = 6 then GUISetState(@SW_SHOW,$tab7GUI)
        
   $tabItemLast = $tabItem
EndFunc
Link to comment
Share on other sites

I have also a question to it.

Can the attached code of a tab switch be written shorter,

using assign, eval, ..... or what else?

br, Reinhard

func TabSwitch($tabItem)
    GUISetState(@SW_HIDE,$tab1GUI)
    GUISetState(@SW_HIDE,$tab2GUI)
    GUISetState(@SW_HIDE,$tab3GUI)
    GUISetState(@SW_HIDE,$tab4GUI)
    GUISetState(@SW_HIDE,$tab5GUI)
    GUISetState(@SW_HIDE,$tab6GUI)
    GUISetState(@SW_HIDE,$tab7GUI)
        
    if $tabItem = 0 then GUISetState(@SW_SHOW,$tab1GUI)
    if $tabItem = 1 then GUISetState(@SW_SHOW,$tab2GUI)
    if $tabItem = 2 then GUISetState(@SW_SHOW,$tab3GUI)
    if $tabItem = 3 then GUISetState(@SW_SHOW,$tab4GUI)
    if $tabItem = 4 then GUISetState(@SW_SHOW,$tab5GUI)
    if $tabItem = 5 then GUISetState(@SW_SHOW,$tab6GUI)     
    if $tabItem = 6 then GUISetState(@SW_SHOW,$tab7GUI)
        
   $tabItemLast = $tabItem
EndFunc
Not tested.

func TabSwitch($tabItem)
    for $it = 0 to 6
           if $tabitem = $it then
            GUISetState(@SW_SHOW,Eval("tab" & $it + 1 & "GUI"))
           else
             GUISetState(@SW_HIDE,Eval("tab" & $it + 1 & "GUI"))
            endif 
         next
        
   $tabItemLast = $tabItem
EndFunc

Or maybe you can use _GUICtrlTab_SetCurFocus

EDIT:Corrected code but still not tested.

Edited by martin
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

..... Not tested.

States Syntax error, but can live with the other solution.

Because I just worked on it. Tab on Tab resizeable (Tab in Tab is british or? ;-)).

Best regards, Reinhard

; Example of TAB on TAB resize
#include <GUIConstants.au3>

Global $mainGUI,$ok_button,$cancel_button

; This window has 2 ok/cancel-buttons
$mainGUI        = GUICreate("Tab on Tab Resize",260,250,20,10,$WS_OVERLAPPEDWINDOW +$WS_CLIPCHILDREN + $WS_CLIPSIBLINGS)
    GUISetStyle(BitOR($WS_MINIMIZEBOX, $WS_MAXIMIZEBOX, $WS_CAPTION, $WS_SIZEBOX, $WS_POPUP, $WS_SYSMENU))
    GUISetBkColor(0x5686A9)
    $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,$mainGUI)
    
    GUISetBkColor(0x46860A)
    $child_tab      = GUICtrlCreateTab(10,10,210,150)
    GUICtrlSetResizing(-1, $GUI_DOCKAUTO)
    $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,$mainGUI)
    GUISetBkColor(0x56869c)
    $listview2      = GUICtrlCreateListView("Col1|Col2",10,10,210,150,-1,$WS_EX_CLIENTEDGE)
        GUICtrlSetResizing(-1, $GUI_DOCKAUTO)
        GUICtrlCreateListViewItem("ItemLong1|ItemLong12", $listview2)
        GUICtrlCreateListViewItem("ItemLong2|Item22", $listview2)
    ;GUISetState()

; Switch back the main GUI and create the tabs
GUISwitch($mainGUI)
$main_tab       = GUICtrlCreateTab(10,10,240,200)
    $child1tab      = GUICtrlCreateTabItem("Child1")
    $child2tab      = GUICtrlCreateTabItem("Child2")
    GUICtrlCreateTabItem("")
GUISetState()

GUIRegisterMsg($WM_SIZE, 'WM_SIZE')
DIM $tabItemLast = 0

While 1
    $msg = GUIGetMsg(1)
    Switch $msg[0]
        Case $GUI_EVENT_CLOSE, $cancel_button
            ExitLoop
            
        Case $main_tab
    $tabItem = GUICtrlRead($main_Tab)
    if $tabItem <> $tabItemLast then TabSwitch($tabItem)
        
    EndSwitch
WEnd

func TabSwitch($tabItem)
    GUISetState(@SW_HIDE,$child1)
    GUISetState(@SW_HIDE,$child2)
            
    if $tabItem = 0 then GUISetState(@SW_SHOW,$child1)
    if $tabItem = 1 then GUISetState(@SW_SHOW,$child2)
    $tabItemLast = $tabItem
EndFunc


Func WM_SIZE($hWnd, $iMsg, $iWParam, $iLParam)
    $aMGPos = WinGetClientSize ($mainGUI) 
    Winmove($child1,"",15,35,+$aMGPos[0]-30,+$aMGPos[1]-80)
    Winmove($child2,"",15,35,+$aMGPos[0]-30,+$aMGPos[1]-80)
;Guictrlsetpos($child_tab,10,10,+$aMGPos[0]-50,+$aMGPos[1]-100)
    Guictrlsetpos($main_tab,10,10,+$aMGPos[0]-20,+$aMGPos[1]-50)
    Guictrlsetpos($listview2,10,10,+$aMGPos[0]-30-20,+$aMGPos[1]-80-20)

endfunc
Edited by ReFran
Link to comment
Share on other sites

Looking good Reinhard.

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Link to comment
Share on other sites

..... Not tested.

States Syntax error, but can live with the other solution.

Yes, brackets missing on 2 lines, I'll correct it.

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

Yes, brackets missing on 2 lines, I'll correct it.

Oh, sooo simple. Works good and gives the script a touch of prefessionalism. Thanks.

49°10"21'N 123°56"47'W = 21 W 47th St New York, NY 10036 USA = near Central Park

I like to rember to "Tavern on the Green".

Link to comment
Share on other sites

  • 8 months later...

Is there a way to navigate in child guis controls with the tabulator?

e. g.

$child1_tabitem1    = GUICtrlCreateTabItem("Child1Tab1")
$radio1 = GUICtrlCreateRadio ("radio 1", 100, 100)
$radio2 = GUICtrlCreateRadio ("radio 2", 100, 150, -1, -1, $WS_TABSTOP)
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...