Sign in to follow this  
Followers 0
smahdi83

Hiding Tabs

5 posts in this topic

Hi,

I have a form which contains a tabbed control. I created new tabs. Now what I want to do is basically hide the tabs on the top. So the user can't select the tab he wants to access. Depending on the action of the user, it will move him to the appropriate tab.

How can I do this?

Thanks in advance,

Share this post


Link to post
Share on other sites



Maybe try GUICtrlSetState and choose $GUI_DISABLE ?

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

How about not allowing user to switch to another tab?

#include <GUIConstants.au3>
#Include <GuiTab.au3>
Const $WM_NOTIFY = 0x4E
Opt("GUIOnEventMode", 1)
$Gui = GUICreate("Forced Tab Demo", 400, 300)
GUISetOnEvent($GUI_EVENT_CLOSE, "GuiClose")
$TabControl = GUICtrlCreateTab(5, 5, 390, 250)
$TabSheet1 = GUICtrlCreateTabItem("Step #1")
$lbl1 = GUICtrlCreateLabel("Label1", 100, 100)
$TabSheet2 = GUICtrlCreateTabItem("Step #2")
$lbl2 = GUICtrlCreateLabel("Label2", 100, 150)
$TabSheet3 = GUICtrlCreateTabItem("Step #3")
$lbl3 = GUICtrlCreateLabel("Label3", 100, 200)
GUICtrlCreateTabItem("")
$btnBack = GUICtrlCreateButton("&Back", 100, 260, 100, 25)
GUICtrlSetOnEvent(-1, "btnBackClick")
$btnNext = GUICtrlCreateButton("&Next", 200, 260, 100, 25)
GUICtrlSetOnEvent(-1, "btnNextClick")
Global $activeTab = _GUICtrlTabGetCurSel($TabControl)
GUIRegisterMsg($WM_NOTIFY, "On_WM_NOTIFY")
GUISetState(@SW_SHOW,$Gui)

While 1
    Sleep(100)
WEnd

Func btnBackClick()
    If $activeTab = 0 Then Return
    $activeTab -= 1
    _GUICtrlTabSetCurFocus($TabControl, $activeTab)
EndFunc
Func btnNextClick()
    If $activeTab = (_GUICtrlTabGetItemCount($TabControl) - 1) Then Return
    $activeTab += 1
    _GUICtrlTabSetCurFocus($TabControl, $activeTab)
EndFunc
Func GuiClose()
    Exit
EndFunc
Func On_WM_NOTIFY($hWnd, $Msg, $wParam, $lParam)
    If $wParam = $TabControl Then
        Local $stNMHDR = DllStructCreate("hwnd;uint;int code", $lParam)
        Local $code = DllStructGetData($stNMHDR, "code")
        $stNMHDR = 0
        If $code == $TCN_SELCHANGING And _GUICtrlTabGetCurFocus($TabControl) == $activeTab Then Return True
    EndIf
EndFunc
Edited by Siao

"be smart, drink your wine"

Share this post


Link to post
Share on other sites

thanks so much thats exactly what I needed!

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  
Followers 0