Jump to content

Recommended Posts

Posted

The below image was created in mspaint !

Can u create a tab inside a tab with autoit like this image shows ?

Posted

The below image was created in mspaint !

Can u create a tab inside a tab with autoit like this image shows ?

<{POST_SNAPBACK}>

The answer is no. I never see such GUI in any application. :)
Posted

Don't try to figure out the logic :)

I'll work out something better, it time permits...

; CyberSlug - 7 April 2005
; Based on http://www.autoitscript.com/forum/index.php?showtopic=6241&hl=multiple++tab

#include <GuiConstants.au3>

$parentGui = GuiCreate("Example")

$regularTab = GuiCtrlCreateTab(50, 50, 200, 100)
GuiCtrlCreateTabItem("foo")
    $button = GuiCtrlCreateButton("Button...", 80, 90, 100, 20)
GuiCtrlCreateTabItem("bar")

$psuedoTab = _createAnotherTab($parentGui, 10, 10, 300, 200)

_createAnotherTabItem($parentGui, $psuedoTab[0], "one")
    $cool = GuiCtrlCreateButton("Cool", 10, 150, 100, 30)
    GuiCtrlSetState($cool, $GUI_SHOW)
_createAnotherTabItem($parentGui, $psuedoTab[0], "two")
    $another = GuiCtrlCreateButton("Another", 10, 50, 100, 30)


guiSetstate(@SW_SHOW, $parentGui)
While 1
    $msg = GUIGetMsg()
    If $msg = $GUI_EVENT_CLOSE Then Exit
    If $msg = $button Then MsgBox(4096,"Notify", "Button clicked")
    If $msg = $cool Then MsgBox(4096,"Notify", "Cool clicked")
    If $msg = $another Then MsgBox(4096,"Notify", "Another clicked")
        
        
    If $msg = $psuedoTab[1] Then
        If GuiCtrlRead($msg) = 0 Then
            GuiCtrlSetState($regularTab, $GUI_SHOW)
            If GuiCtrlRead($regularTab) = 0 Then GuiCtrlSetState($button, $GUI_SHOW)
            If GuiCtrlRead($regularTab) = 1 Then GuiCtrlSetState($button, $GUI_HIDE)
        Else
            GuiCtrlSetState($regularTab, $GUI_HIDE)
            GuiCtrlSetState($button, $GUI_HIDE)
        EndIf
    EndIf
    
    If $msg = $regularTab Then
        If GuiCtrlRead($regularTab) = 0 Then GuiCtrlSetState($button, $GUI_SHOW)
        If GuiCtrlRead($regularTab) = 1 Then GuiCtrlSetState($button, $GUI_HIDE)
    EndIf
WEnd



; Create ANOTHER tab control at the specified coordinates, and return a handle (window handle)...
; array[0] = window handle, array[1] = control id
Func _createAnotherTab($parentGui, $left, $top, $width, $height)
  Local $style = 0x56000000;WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN
  Local $tabCtrlWin = GuiCreate("", $width, $height, $left,$top, $WS_CHILD, -1, $parentGui)
  Local $tabCtrlID = GuiCtrlCreateTab(0, 0, $width, $height)
  GuiSetState()
  GuiSwitch($parentGui)
  Local $array[2]
  $array[0] = $tabCtrlWin
  $array[1] = $tabCtrlID
  Return $array
EndFunc

Func _createAnotherTabItem($parentGui, $tabHandle, $text)
  GuiSwitch($tabHandle)
  Local $itemID = GuiCtrlCreateTabItem($text)
  If $text = "" Then GuiSwitch($parentGui);remember null text denotes "closing" tabitem
  Return $itemID
EndFunc
Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig!
Posted

Don't try to figure out the logic :)

I'll work out something better, it time permits...

<{POST_SNAPBACK}>

IU was answering on the same GUI, YOu right each GUI can have one tab :D
Posted

I never see such GUI in any application. :)

<{POST_SNAPBACK}>

BTW this is common practice in the Delphi and C++ Builder programs (using page control, but don't know what it is internally). For example screenshot from IsoBuster:

Imo this looks ugly and it's really unconvenient. Much better options layouts with tree at left.

Posted

Thanks everybody for this compilation of program using nested tab.

I think we will stay with CyberSlug simulation due to the heavy bounding of the code handling tab with only one GUI.

If a day I found a bright solution to overcome this limitation I will implement it for your satisfaction( in fact mine too)

Posted

Quick question, why dose the parent tab get overlapped by the child tab ?

By defination shouldnt the $psuedoTab sit on top of the $regularTab instead of the $regularTab sitting on top of the $psuedoTab ?

Heres an example of the problem Im having !

; CyberSlug - 7 April 2005
; Based on http://www.autoitscript.com/forum/index.php?showtopic=6241&hl=multiple++tab

#include <GuiConstants.au3>

$parentGui = GUICreate("Example", 1000,800)

$regularTab = GuiCtrlCreateTab(20,20, 960,740)
GuiCtrlCreateTabItem("foo")
    $button = GuiCtrlCreateButton("Button...", 80, 90, 100, 20)
GuiCtrlCreateTabItem("bar")

$psuedoTab = _createAnotherTab($parentGui, 50, 220, 900, 550)

_createAnotherTabItem($parentGui, $psuedoTab[0], "one")
    $cool = GuiCtrlCreateButton("Cool", 10, 150, 100, 30)
    GuiCtrlSetState($cool, $GUI_SHOW)
_createAnotherTabItem($parentGui, $psuedoTab[0], "two")
    $another = GuiCtrlCreateButton("Another", 10, 50, 100, 30)


guiSetstate(@SW_SHOW, $parentGui)
While 1
    $msg = GUIGetMsg()
    If $msg = $GUI_EVENT_CLOSE Then Exit
    If $msg = $button Then MsgBox(4096,"Notify", "Button clicked")
    If $msg = $cool Then MsgBox(4096,"Notify", "Cool clicked")
    If $msg = $another Then MsgBox(4096,"Notify", "Another clicked")
        
        
    If $msg = $psuedoTab[1] Then
        If GuiCtrlRead($msg) = 0 Then
            GuiCtrlSetState($regularTab, $GUI_SHOW)
            If GuiCtrlRead($regularTab) = 0 Then GuiCtrlSetState($button, $GUI_SHOW)
            If GuiCtrlRead($regularTab) = 1 Then GuiCtrlSetState($button, $GUI_HIDE)
        Else
            GuiCtrlSetState($regularTab, $GUI_HIDE)
            GuiCtrlSetState($button, $GUI_HIDE)
        EndIf
    EndIf
    
    If $msg = $regularTab Then
        If GuiCtrlRead($regularTab) = 0 Then GuiCtrlSetState($button, $GUI_SHOW)
        If GuiCtrlRead($regularTab) = 1 Then GuiCtrlSetState($button, $GUI_HIDE)
    EndIf
WEnd



; Create ANOTHER tab control at the specified coordinates, and return a handle (window handle)...
; array[0] = window handle, array[1] = control id
Func _createAnotherTab($parentGui, $left, $top, $width, $height)
  Local $style = 0x56000000;WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN
  Local $tabCtrlWin = GuiCreate("", $width, $height, $left,$top, $WS_CHILD, -1, $parentGui)
  Local $tabCtrlID = GuiCtrlCreateTab(0, 0, $width, $height)
  GuiSetState()
  GuiSwitch($parentGui)
  Local $array[2]
  $array[0] = $tabCtrlWin
  $array[1] = $tabCtrlID
  Return $array
EndFunc

Func _createAnotherTabItem($parentGui, $tabHandle, $text)
  GuiSwitch($tabHandle)
  Local $itemID = GuiCtrlCreateTabItem($text)
  If $text = "" Then GuiSwitch($parentGui);remember null text denotes "closing" tabitem
  Return $itemID
EndFunc
Posted

@CyberSlug Im trying to create a nested tab inside the second tabitem of a ctrltab using ur above _createAnotherTab UDF

I can only manage to place the tab inside the first tabitem of the ctrltab.

Heres a pic of what i trying to do

And some code that dosent work :)

#include <GuiConstants.au3>

$parentGui = GuiCreate("Example")

$regularTab = GuiCtrlCreateTab(50, 50, 200, 100)
GuiCtrlCreateTabItem("foo")
GuiCtrlCreateTabItem("bar")

$psuedoTab = _createAnotherTab($parentGui, 10, 10, 300, 200)

_createAnotherTabItem($parentGui, $psuedoTab[0], "1")
_createAnotherTabItem($parentGui, $psuedoTab[0], "2")
    [B]$regularTab = GuiCtrlCreateTab (50,220, 900, 550)
    GuiCtrlCreateTabItem("A")
    GuiCtrlCreateTabItem("B")
    GuiCtrlCreateTabItem("C")[/B]

guiSetstate(@SW_SHOW, $parentGui)
While 1
    $msg = GUIGetMsg()
    If $msg = $GUI_EVENT_CLOSE Then Exit
        
    If $msg = $psuedoTab[1] Then
        If GuiCtrlRead($msg) = 0 Then
            GuiCtrlSetState($regularTab, $GUI_SHOW)
        Else
            GuiCtrlSetState($regularTab, $GUI_HIDE)
        EndIf
    EndIf
WEnd

; Create ANOTHER tab control at the specified coordinates, and return a handle (window handle)...
; array[0] = window handle, array[1] = control id
Func _createAnotherTab($parentGui, $left, $top, $width, $height)
  Local $style = 0x56000000;WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN
  Local $tabCtrlWin = GuiCreate("", $width, $height, $left,$top, $WS_CHILD, -1, $parentGui)
  Local $tabCtrlID = GuiCtrlCreateTab(0, 0, $width, $height)
  GuiSetState()
  GuiSwitch($parentGui)
  Local $array[2]
  $array[0] = $tabCtrlWin
  $array[1] = $tabCtrlID
  Return $array
EndFunc

Func _createAnotherTabItem($parentGui, $tabHandle, $text)
  GuiSwitch($tabHandle)
  Local $itemID = GuiCtrlCreateTabItem($text)
  If $text = "" Then GuiSwitch($parentGui);remember null text denotes "closing" tabitem
  Return $itemID
EndFunc
Posted

as I understand the Cyberslug code manage the display of the tab on tab.

the main tab is the tab which look in front is a smaller tab control.

the received msg manage the hiding/showing of what is needed.

Perhaps CyberSlug can help more.

I understand it is a little tricky to design such tab on tab but for the time being before I got bright ideas you have to exercise yours :)

Posted

Tnx for ur reply jpm !

Id really appriachate some further help on this issue !

It seems theres been quite a bit of posting going on this evening.... I dont want this topic to get burried !

Posted

I meant to post earlier, but jpm summed it up pretty well.

With multiple tab controls, you have to manually show/hide the controls. When you click on a tab item, you need to determine what needs shown or hidden.

(By the way, the reason the "psuedotab" is actually the bigger tab in my example is because I could not get the tabs to disaplay correct if nested the other way. Psuedotab within real tab just didn't work...)

Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig!
Posted

Psuedotab within real tab just didn't work...

I found the same problem when I tryed to make the guictrlcreatetab the primary tab !

Tnx for your help,

Nova

Posted (edited)

With multiple tab controls, you have to manually show/hide the controls

So editing ur above code..... Changing $psuedoTab[1] into $psuedoTab[2] should show the Guicreatetab in the second tab item of the $psuedoTab.......rite ?

How come I get an array error msg when I try this ?

While 1
    $msg = GUIGetMsg()
    If $msg = $GUI_EVENT_CLOSE Then Exit
        
    If $msg = $psuedoTab[2] Then
        If GuiCtrlRead($msg) = 0 Then
            GuiCtrlSetState($regularTab, $GUI_SHOW)
        Else
            GuiCtrlSetState($regularTab, $GUI_HIDE)
        EndIf
    EndIf
WEnd
Edited by Nova
Posted

I think ive figured it out GuiCtrlRead($regularTab) returns the selected tabitem number !

Ill mess with it when I get home !

Cheers,

Nova

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...