Jump to content
Sign in to follow this  
E1M1

What's wrong with tab?

Recommended Posts

Lars

Hi there if I test it like this

CODE

$myTab = GUICtrlCreateTab(32, 24, 145, 97)

$myTabSheet1 = GUICtrlCreateTabItem("Untitled")

$myTabSheet2 = GUICtrlCreateTabItem("Untitled2")

It works like candy :D

Share this post


Link to post
Share on other sites
E1M1

but with this example I cant use other tab commands like _GUICtrlTab_GetItemText()?

Thanks anyway.

Edited by E1M1

edited

Share this post


Link to post
Share on other sites
DjDeep00

@E1M1...

Remember that when you use any of the advanced controls like _GuiCtrlCreate*, these controls are not standard controls and currently AutoIt does not play nice with them.

However you can control these yourself by using WM_NOTIFY()

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

$Form1 = GUICreate("test",200,200)

$hTab = _GUICtrlTab_Create($Form1, 0, 0, 640, 120)
_GUICtrlTab_InsertItem($hTab, 0 ,"Untitled")

$Label1 = GUICtrlCreateLabel ( "text",50,50,75,20)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)

_GUICtrlTab_InsertItem($hTab, 1 ,"Untitled2")

GUISetState()

GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY")

While 1
    $msg = GUIGetMsg()

    If $msg = $GUI_EVENT_CLOSE Then ExitLoop

WEnd

GUIDelete()

Func WM_NOTIFY($hWnd, $Msg, $wParam, $lParam)
    Local $hWndTab, $tNMHDR, $HwndFrom, $iCode
   
    $hWndTab = $hTab
    If Not IsHWnd($hWndTab) Then $hWndTab = GUICtrlGetHandle($hTab)
   
    $tNMHDR = DllStructCreate($tagNMHDR, $lParam)
    $HwndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom"))
    $iCode = DllStructGetData($tNMHDR, "Code")
   
    Switch $HwndFrom
        Case $hWndTab
            Switch $iCode
                Case $TCN_SELCHANGE
                    Switch _GUICtrlTab_GetCurSel($hTab)
                        Case 0
                           GUICtrlSetState($Label1,$GUI_SHOW)
                        Case 1
                           GUICtrlSetState($Label1,$GUI_HIDE)
                        Case 2; Third tab...
                        Case 3; Fourth tab...
                    EndSwitch
            EndSwitch
    EndSwitch
   
    Return $GUI_RUNDEFMSG
EndFunc

:D

Share this post


Link to post
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
Sign in to follow this  

×