Jump to content

Background color in tabs


muncherw
 Share

Recommended Posts

I have tab with several items in it. The bacground to my gui is a light blue and I'd like the background of the tabs to be the same but can't figure out how to do it. A picture has been added so you can see what I'm talking about. Any suggestions? I've tried GUISetBkColor and GUICtrlSetBkColor with no luck.

Posted Image

Other People's Stuff:Andy Flesner's AutoIt v3: Your Quick Guide[topic="34302"]Locodarwin's ExcelCom_UDF[/topic][topic="61090"]MrCreatorR's Opera Library[/topic]
Link to comment
Share on other sites

Very good. Thanks! Appreciate the help.

But there are a couple of work-arounds.

One way which can give a satisfactory result is to have a label with no text and with the correct colour covering the area where there is no tab. If you do this you might want to adjust the position of the label depending on whether the end tab is selected or not, but the variation in the gap between the last tab and the label might not be be a concern.

The second way is to increase the tab widths so that there is no gap with the wrong colour.

#include <GUIConstantsEx.au3>

Opt('MustDeclareVars', 1)

Example()

Func Example()
    Local $tab, $tab0, $tab0OK, $tab0input
    Local $tab1, $tab1combo, $tab1OK
    Local $tab2, $tab2OK, $msg, $labcover

    GUICreate("My GUI Tab"); will create a dialog box that when displayed is centered

    GUISetBkColor(0x00E0FFFF)
    GUISetFont(9, 300)

    $tab = GUICtrlCreateTab(10, 10, 200, 100)

    $tab0 = GUICtrlCreateTabItem("tab0")
    GUICtrlCreateLabel("label0", 30, 80, 50, 20)

    $tab1 = GUICtrlCreateTabItem("tab----1")
    GUICtrlCreateLabel("label1", 30, 70, 50, 20)

    $tab2 = GUICtrlCreateTabItem("tab2")
    GUICtrlSetState(-1, $GUI_SHOW); will be display first

    GUICtrlCreateTabItem(""); end tabitem definition
    $labcover = GUICtrlCreateLabel("", 154, 10, 80, 22)
    GUICtrlSetBkColor(-1, 0x00E0FFFF)

    GUISetState()

   ; Run the GUI until the dialog is closed
    While 1
        $msg = GUIGetMsg()
        If $msg = $tab Then
            If GUICtrlRead($tab) = 2 Then
                ControlMove("My GUI Tab", "", $labcover, 154, 10)
            Else
                ControlMove("My GUI Tab", "", $labcover, 150, 10)
            EndIf
        EndIf

        If $msg = $GUI_EVENT_CLOSE Then ExitLoop
    WEnd
EndFunc  ;==>Example

#include <GUIConstantsEx.au3>
#include <Constants.au3>
#include <tabconstants.au3>

Opt('MustDeclareVars', 1)

Example()

Func Example()
    Local $tab, $tab0, $tab0OK, $tab0input
    Local $tab1, $tab1combo, $tab1OK
    Local $tab2, $tab2OK, $msg, $labcover

    GUICreate("My GUI Tab"); will create a dialog box that when displayed is centered

    GUISetBkColor(0x00E0FFFF)
    GUISetFont(9, 300)

    $tab = GUICtrlCreateTab(10, 10, 200, 100,$TCS_FIXEDWIDTH);must have fixed width to be able to set tab widths
    $tab0 = GUICtrlCreateTabItem("tab0")
    GUICtrlCreateLabel("label0", 30, 80, 50, 20)

    $tab1 = GUICtrlCreateTabItem("tab1")
    GUICtrlCreateLabel("label1", 30, 70, 50, 20)

    $tab2 = GUICtrlCreateTabItem("tab2")
    GUICtrlSetState(-1, $GUI_SHOW); will be display first

    GUICtrlCreateTabItem(""); end tabitem definition
   

    GUISetState()
GuictrlSendMsg($Tab, $TCM_SETITEMSIZE, 0, _MakeLong(65, 20))
   ; Run the GUI until the dialog is closed
    While 1
        $msg = GUIGetMsg()
       

        If $msg = $GUI_EVENT_CLOSE Then ExitLoop
    WEnd
EndFunc  ;==>Example

Func _MakeLong($l, $h)
    Return BitOR(BitAnd($l, 0xFFFF), BitShift(BitAnd($h, 0xFFFF), -16))
EndFunc; _MakeLong()
Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
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...