Jump to content

Hiding Tabs


Recommended Posts

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,

Link to comment
Share on other sites

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"

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