Jump to content

Multiple Tabs


 Share

Recommended Posts

Is it possible to have multiple tabs in the same GUI? For some reason, it doesnt work for me. It adds the seperate GUICtrlCreateTab into the first one created, and populates the tabs in it. Please help :P

#Region --- Main Tabs ---
    $cMainTab = GUICtrlCreateTab(3, 28, 250, 530, BitOr($TCS_HOTTRACK, $TCS_TOOLTIPS ))
        Dim $cListViewTab = GUICtrlCreateTabItem(' ')
            GUICtrlSetTip($cListViewTab, 'List View')
            GUICtrlSetImage($cListViewTab, $sUIDLL, 24)
        Dim $cDomainViewTab = GUICtrlCreateTabItem(' ')
            GUICtrlSetTip($cDomainViewTab, 'Domain View')
            GUICtrlSetImage($cDomainViewTab, $sUIDLL, 98)
    GUICtrlCreateTabitem(''); End Tabs
#EndRegion --- Main Tabs End ---

#Region --- Information Tabs ---
    $cInformationTab = GUICtrlCreateTab(300, 28, 250, 530, BitOr($TCS_HOTTRACK, $TCS_TOOLTIPS ))
        Dim $cSystemTab = GUICtrlCreateTabItem('System')
            GUICtrlSetTip($cSystemTab, 'System')
            GUICtrlSetImage($cSystemTab, $sUIDLL, 117)
        Dim $cPeripheralsTab = GUICtrlCreateTabItem('Peripherals')
            GUICtrlSetTip($cPeripheralsTab, 'Peripherals')
            GUICtrlSetImage($cPeripheralsTab, $sUIDLL, 115)
        Dim $cProcessesTab = GUICtrlCreateTabItem('Processes')
            GUICtrlSetTip($cProcessesTab, 'Processes')
            GUICtrlSetImage($cProcessesTab, $sUIDLL, 4)
        Dim $cServicesTab = GUICtrlCreateTabItem('Services')
            GUICtrlSetTip($cServicesTab, 'Services')
            GUICtrlSetImage($cServicesTab, $sUIDLL, 114)
    GUICtrlCreateTabitem(''); End Tabs
#EndRegion --- Information Tabs End ---
Edited by RagnaroktA
Current Projects:Remote Administration Suite Updated! 12-20-07Remote User State Migration Tool (Plugin) Updated! 12-20-07Batch Print Wizard Updated! 12-20-07Links:AutoIt Beta | AutoIt Wiki
Link to comment
Share on other sites

  • Moderators

Seven views, and nothing? C'mon guys, at least tell me I'm not crazy/stupid.

Did you try putting them in GUICtrlCreateGroup()?

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

  • Moderators

Did you try creating maybe a Child GUI with a tab in it, attached to the main GUI?

Edit:

#include <guiconstants.au3>
$Main = GUICreate('My GUI', 400, 400)

$T1 = GUICtrlCreateTab(10, 10, 100, 30)
$T1i = GUICtrlCreateTabItem('Tab 1')
$T2i  = GUICtrlCreateTabItem('Tab 2')
GUICtrlCreateTabItem('') ;End Tab

$Child = GUICreate('', 100, 30, 10, 40, $WS_POPUP, $WS_EX_MDICHILD, $Main)
$T2 = GUICtrlCreateTab(0, 0, 100, 30)
$Ti1 = GUICtrlCreateTabItem('Tab 1')
$Ti2 = GUICtrlCreateTabItem('Tab 2')
GUICtrlCreateTabItem('') ;End Tab

GUISetState(@SW_SHOW, $Child)
GUISetState(@SW_SHOW, $Main)

While GUIGetMsg() <> -3
WEnd
Edited by SmOke_N

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

  • Moderators

Brilliant. :P

Thanks alot, I really appreciate it.

Your welcome, I must admit, I don't like the way it disables the main to interact with the child, so it looked better if you used $WS_POPUP on the main as well so you don't see the Title jumping back and forth. But I can't even imagine there's not a better solution for this.

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

  • Moderators

Here, made a little UDF, so you can just write the tab in there like you would do normally (adding Child on the end...) it returns a 2 element array... [0] will have the handle for the Child GUI and [1] will return the Control ID to the Tab.

#include <guiconstants.au3>
$Main = GUICreate('My GUI', 400, 400, -1, -1, $WS_POPUP)

$T1 = GUICtrlCreateTab(10, 10, 100, 30)
$T1i = GUICtrlCreateTabItem('Tab 1')
$T2i  = GUICtrlCreateTabItem('Tab 2')
GUICtrlCreateTabItem('') ;End Tab

$Ti = _GUICtrlCreateTabChild($Main, 10, 40, 100, 30)
$Ti1 = GUICtrlCreateTabItem('Tab 1')
$Ti2 = GUICtrlCreateTabItem('Tab 2')
GUICtrlCreateTabItem('') ;End Tab

GUISetState(@SW_SHOW, $Ti[0])
GUISetState(@SW_SHOW, $Main)

While GUIGetMsg() <> -3
WEnd

Func _GUICtrlCreateTabChild($hMainHwnd, $iLeft, $iTop, $iWidth = -1, $iHeight = -1, $nStyle = 0x80000000, $nStyleEX = 0x00000040)
    Local $aControls[2]
    $aControls[0] = GUICreate('', $iWidth, $iHeight, $iLeft, $iTop, $nStyle, $nStyleEX, $hMainHwnd)
    $aControls[1] = GUICtrlCreateTab(0, 0, $iWidth, $iHeight)
    Return $aControls ;Returns an Arrau [0] = ChildHwnd [1] = Tab Control ID
EndFunc

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

Alright, whole different problem now. When the parent GUI is moved resized, the tab gui does not move or resize with it... can this be prevented?

Edited by RagnaroktA
Current Projects:Remote Administration Suite Updated! 12-20-07Remote User State Migration Tool (Plugin) Updated! 12-20-07Batch Print Wizard Updated! 12-20-07Links:AutoIt Beta | AutoIt Wiki
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...