Jump to content

Tab Control Inside Another Tab Control


Recommended Posts

Hello,

If I create a tab with GUICtrlCreateTab() and then try to add another tab inside that, it doesn't seem to work. Is there a workaround for this or is it just impossible?

Here is a picture of what I am trying to do:

post-53496-12607647402013_thumb.png

Try Pacfox, my Firefox theme.Try Power Eject, my windows gadget that allows you to eject most drives.Using AutoIt 3.3.4.0, Windows 7 Premium, Intel Core 2 Quad CPU @ 2.66ghz, 4gb RAM, Nvidia GeForce 9500GT Graphics Card & Samsung 22" Monitor.
Link to comment
Share on other sites

Thanks for the link, although I can't get any to work...they just seem to give me warnings and errors...

Here is the output from scite for the second example:

C:\Users\Josh\Desktop\AutoIt Scripts\Experimental Script.au3(7,85) : WARNING: $GUI_SS_DEFAULT_GUI: possibly used before declaration.

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

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^

C:\Users\Josh\Desktop\AutoIt Scripts\Experimental Script.au3(7,102) : WARNING: $WS_CLIPSIBLINGS: possibly used before declaration.

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

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^

C:\Users\Josh\Desktop\AutoIt Scripts\Experimental Script.au3(14,61) : WARNING: $WS_CHILD: possibly used before declaration.

$child1 = GUICreate("",230,170,15,35,BitOr($WS_CHILD,

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^

C:\Users\Josh\Desktop\AutoIt Scripts\Experimental Script.au3(14,73) : WARNING: $WS_TABSTOP: possibly used before declaration.

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

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^

C:\Users\Josh\Desktop\AutoIt Scripts\Experimental Script.au3(7,85) : ERROR: $GUI_SS_DEFAULT_GUI: undeclared global variable.

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

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^

C:\Users\Josh\Desktop\AutoIt Scripts\Experimental Script.au3 - 1 error(s), 4 warning(s)

Possibly missing an include file?
Try Pacfox, my Firefox theme.Try Power Eject, my windows gadget that allows you to eject most drives.Using AutoIt 3.3.4.0, Windows 7 Premium, Intel Core 2 Quad CPU @ 2.66ghz, 4gb RAM, Nvidia GeForce 9500GT Graphics Card & Samsung 22" Monitor.
Link to comment
Share on other sites

I've been considering your OwnTab UDF, but I really wanted the native OS look. Can this be achieved with your UDF?

Edited by Vadersapien
Try Pacfox, my Firefox theme.Try Power Eject, my windows gadget that allows you to eject most drives.Using AutoIt 3.3.4.0, Windows 7 Premium, Intel Core 2 Quad CPU @ 2.66ghz, 4gb RAM, Nvidia GeForce 9500GT Graphics Card & Samsung 22" Monitor.
Link to comment
Share on other sites

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
Opt('MustDeclareVars', 1)

Local $hGUI, $Tab, $hTab, $TabItem1, $TabItem2, $hChild1, $hChild2, $Btn1Child1, $Btn2Child1, $Btn1Child2, $Btn2Child2

$hGUI = GUICreate("Title", 300, 300)

$Tab = GUICtrlCreateTab(0, 0, 300, 300)
$hTab = GUICtrlGetHandle(-1)

GUICtrlCreateTabItem("Tab1")
GUICtrlCreateTabItem("Tab2")

$TabItem1 = 0
$TabItem2 = 1

$hChild1 = GUICreate("", 200, 200, 50, 50, $WS_CHILD, -1, $hTab)
GUICtrlCreateTab(0, 0, 200, 200)
GUICtrlCreateTabItem("Child1 Tab1")
$Btn1Child1 = GUICtrlCreateButton("Button 1", 65, 90, 70, 25)
GUICtrlCreateTabItem("Child1 Tab2")
$Btn2Child1 = GUICtrlCreateButton("Button 2", 65, 90, 70, 25)
GUISwitch($hChild1)
GUISetState()

$hChild2 = GUICreate("", 200, 200, 50, 50, $WS_CHILD, -1, $hTab)
GUICtrlCreateTab(0, 0, 200, 200)
GUICtrlCreateTabItem("Child2 Tab1")
$Btn1Child2 = GUICtrlCreateButton("Button 1", 65, 90, 70, 25)
GUICtrlCreateTabItem("Child2 Tab2")
$Btn2Child2 = GUICtrlCreateButton("Button 2", 65, 90, 70, 25)

GUISwitch($hGUI)
GUISetState()

While 1
    
    Switch GUIGetMsg()
        Case $Tab
            Switch GUICtrlRead($Tab)
                Case $TabItem1
                    GUISetState(@SW_HIDE, $hChild2)
                    GUISetState(@SW_SHOW, $hChild1)
                Case $TabItem2
                    GUISetState(@SW_HIDE, $hChild1)
                    GUISetState(@SW_SHOW, $hChild2)
            EndSwitch
            
        Case $Btn1Child1
            ConsoleWrite("Button1 Child1" & @CRLF)
        
        Case $Btn2Child1
            ConsoleWrite("Button2 Child1" & @CRLF)
            
        Case $Btn1Child2
            ConsoleWrite("Button1 Child2" & @CRLF)
            
        Case $Btn2Child2
            ConsoleWrite("Button2 Child2" & @CRLF)
            
        Case $GUI_EVENT_CLOSE
            ExitLoop
    EndSwitch
WEnd

GUIDelete()
Exit

I hope it's not flickering over there, if yes, consider using _WinAPI_SetWindowPos.

Link to comment
Share on other sites

Thanks Authenticity! Helpful as always ;) . It works perfect, athough I find it easier to use

Switch GUICtrlRead($Tab, 1)

That way you can directly specify the Control ID of the tab in the Case statement.

Try Pacfox, my Firefox theme.Try Power Eject, my windows gadget that allows you to eject most drives.Using AutoIt 3.3.4.0, Windows 7 Premium, Intel Core 2 Quad CPU @ 2.66ghz, 4gb RAM, Nvidia GeForce 9500GT Graphics Card & Samsung 22" Monitor.
Link to comment
Share on other sites

You may have a look at this example:

http://www.autoitscript.com/forum/index.php?showtopic=63489&st=0&p=474000&hl=reinhard%20tab%20on%20tab&fromsearch=1&#entry474000

It's round about what you got already,

but the tabswitch in a function gives you a higher flexibility and cost nothing ;)

HTH, Reinhard

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