Sign in to follow this  
Followers 0
Bert

marking tabs

3 posts in this topic

I have a script that I need a way to tweak each tab. What I want to do is simply change a tab in some manner to show if it is enabled or not. changing the text on the tab to bold, change the color, disable it, whatever works. I can't find a method that will let me do anything other than change the text. I did a search and found many post, but nothing that would give me any direction.

Thoughts?

#include <GuiConstants.au3>

GuiCreate("MyGUI", 680, 341,-1, -1 , BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS))
$tab_1 = GUICtrlCreateTab(0, 0, 680, 280)
$tab0=GUICtrlCreateTabitem ("Main")
$List_1 = GuiCtrlCreateList("", 10, 30, 130, 240)
$Edit_2 = GuiCtrlCreateEdit("", 147, 30, 521, 240)
$Button_3 = GuiCtrlCreateButton("Add", 10, 310, 50, 20)
$Button_4 = GuiCtrlCreateButton("Remove", 70, 310, 50, 20)
$Button_5 = GuiCtrlCreateButton("Cancel", 130, 310, 50, 20)
$Button_6 = GuiCtrlCreateButton("Add Tab", 520, 310, 60, 20)
$Button_7 = GuiCtrlCreateButton("Remove tab", 590, 310, 70, 20)
$Group_8 = GuiCtrlCreateGroup("Tab control", 510, 290, 160, 50)
$tab1 = GUICtrlCreateTabitem ("Pictures")
GUICtrlSetState($tab1, $GUI_hide) ;doesn't work. this command won't do anything in fact.
$tab2 = GUICtrlCreateTabitem ("links")

GuiSetState()
While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    Case Else
        ;;;
    EndSelect
WEnd
Exit

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

This is one way to do it:

#include <GuiConstants.au3>
#Include <GuiTab.au3>

GuiCreate("MyGUI", 680, 341,-1, -1 , BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS))
$tab_1 = GUICtrlCreateTab(0, 0, 680, 280)
$tab0=GUICtrlCreateTabitem ("Main")
_GUICtrlTabHighlightItem($tab_1, 0, True)
$List_1 = GuiCtrlCreateList("", 10, 30, 130, 240)
$Edit_2 = GuiCtrlCreateEdit("", 147, 30, 521, 240)
$Button_3 = GuiCtrlCreateButton("Add", 10, 310, 50, 20)
$Button_4 = GuiCtrlCreateButton("Remove", 70, 310, 50, 20)
$Button_5 = GuiCtrlCreateButton("Cancel", 130, 310, 50, 20)
$Button_6 = GuiCtrlCreateButton("Add Tab", 520, 310, 60, 20)
$Button_7 = GuiCtrlCreateButton("Remove tab", 590, 310, 70, 20)
$Group_8 = GuiCtrlCreateGroup("Tab control", 510, 290, 160, 50)
$tab1 = GUICtrlCreateTabitem ("Pictures")
GUICtrlSetState($tab1, $GUI_hide);doesn't work. this command won't do anything in fact.
$tab2 = GUICtrlCreateTabitem ("links")

GuiSetState()
While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    Case $msg = $tab_1
        $TabsCount = _GUICtrlTabGetItemCount($tab_1) - 1
        $TabSelected = _GUICtrlTabGetCurSel($tab_1)
        If $TabSelected <> $TC_ERR Then
            _GUICtrlTabHighlightItem($tab_1, $TabSelected, True)
            For $x = 0 To $TabsCount
                If $x <> $TabSelected Then _GUICtrlTabHighlightItem($tab_1, $x, False)
            Next
        EndIf
    Case Else
       ;;;
    EndSelect
WEnd
Exit

Edited by Danny35d

AutoIt Scripts:NetPrinter - Network Printer UtilityRobocopyGUI - GUI interface for M$ robocopy command line

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Not bad. I'm looking for a way to mark the tab when it is disabled. Say green for the tabs that are enabled, and red for the ones that are disabled. Currently, the only way I thought of is a child menu that will change the name of the tab so if the name is "", it doesn't show up.

Edited by Volly

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