Jump to content
Sign in to follow this  
DCCD

"Tab control" GetColor?

Recommended Posts

DCCD

Hi, Is this the right way?

#include <GUIConstants.au3>
;
$hGui         = GUICreate("My GUI Tab", 600, 500, 193, 115 )

GUISetBkColor (0xE0FFFF)
$tab          = GUICtrlCreateTab (-1,-1, 604,504)
$tab0         = GUICtrlCreateTabitem ("If")
$tab1         = GUICtrlCreateTabitem ("@error")
$tab2         = GUICtrlCreateTabitem ("Then")
$tab3         = GUICtrlCreateTabitem ("Exit")
GUICtrlCreateTabitem ("")   ; end tabitem definition
;
GUISetState ()
_GetColor($hGui, $tab)
; Run the GUI until the dialog is closed
While 1
    $msg = GUIGetMsg()
    If $msg = $GUI_EVENT_CLOSE Then ExitLoop
Wend

Func _GetColor($hWnd, $hSysTab32) 
    $aTabPos = ControlGetPos($hWnd, "", $hSysTab32)
    ;
    ;$X = $aTabPos[0]
    ;$Y = $aTabPos[1]
    $W = $aTabPos[2]
    $H = $aTabPos[3]
    $var = PixelGetColor( $w , $h)
    TrayTip("GUICtrlCreateTab Stats...", "SIZE: " & $w &"," & $h &@CR&"HexColor = 0x"&Hex($var, 6), 10, 1)
    MsgBox(0,"The hex color is", "0x"&Hex($var, 6))
EndFunc
Edited by DCCD

Share this post


Link to post
Share on other sites
Melba23

DCCD,

Please do not bump your own post within 24 hours. Remember this is not a 24/7 support forum - those who answer are only here because they like helping others and have some time to spare. You just have to wait until someone who knows something about your particular problem, and is willing to help, comes online. Be patient and someone will answer eventually. Or if not - tough! ;-)

This code will get the size and colour of a tab:

#Include <GuiTab.au3>

Opt('PixelCoordMode', 2)

$hGUI = GUICreate('Test', 380, 400)
$hTab = GUICtrlCreateTab(10, 10, 360, 380)
$hTab0 = GUICtrlCreateTabItem('Tab')
GUISetState()

$aTab_Size = _GUICtrlTab_GetDisplayRect(GUICtrlGetHandle($hTab))
$iTab_Colour = '0x' & StringRight(Hex(PixelGetColor(0, 0, $hTab)), 6)

MsgBox(0, '', 'Tab size:   ' & $aTab_Size[2] - $aTab_Size[0] & ' x ' & $aTab_Size[3] - $aTab_Size[1] & @CRLF & @CRLF& _
              'Tab colour: ' & $iTab_Colour)

Who can say whether it or your effort is more "right"? The most important criterion is that it works!

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites
Yashied

Hi, Is this the right way?

#include <GUIConstants.au3>
;
$hGui         = GUICreate("My GUI Tab", 600, 500, 193, 115 )

GUISetBkColor (0xE0FFFF)
$tab          = GUICtrlCreateTab (-1,-1, 604,504)
$tab0         = GUICtrlCreateTabitem ("If")
$tab1         = GUICtrlCreateTabitem ("@error")
$tab2         = GUICtrlCreateTabitem ("Then")
$tab3         = GUICtrlCreateTabitem ("Exit")
GUICtrlCreateTabitem ("")   ; end tabitem definition
;
GUISetState ()
_GetColor($hGui, $tab)
; Run the GUI until the dialog is closed
While 1
    $msg = GUIGetMsg()
    If $msg = $GUI_EVENT_CLOSE Then ExitLoop
Wend

Func _GetColor($hWnd, $hSysTab32) 
    $aTabPos = ControlGetPos($hWnd, "", $hSysTab32)
    ;
    ;$X = $aTabPos[0]
    ;$Y = $aTabPos[1]
    $W = $aTabPos[2]
    $H = $aTabPos[3]
    $var = PixelGetColor( $w , $h)
    TrayTip("GUICtrlCreateTab Stats...", "SIZE: " & $w &"," & $h &@CR&"HexColor = 0x"&Hex($var, 6), 10, 1)
    MsgBox(0,"The hex color is", "0x"&Hex($var, 6))
EndFuncoÝ÷ Ûú®¢×¡K~e£ºÚ"µÍÚ[ÛYH  ÑÕRPÛÛÝ[Ë]LÉÝÂÚ[ÛYH  ÑÕRPÛÛÝ[Ë]LÉÝÂÜ
    ÌÎNÔ^[ÛÛÜ[ÙIÌÎNËBÌÍÚÝZHHÕRPÜX]J ][ÝÓ^HÕRHX][ÝË

LNLËLMH
BÕRTÙ]ÐÛÛÜ
LBÌÍÝXHÕRPÝÜX]UX



L
BÌÍÝXHÕRPÝÜX]UX][H
    ][ÝÒY][ÝÊBÌÍÝXHHÕRPÝÜX]UX][H
    ][ÝÐÜ][ÝÊBÌÍÝXHÕRPÝÜX]UX][H
    ][ÝÕ[][ÝÊBÌÍÝXÈHÕRPÝÜX]UX][H
    ][ÝÑ^]    ][ÝÊBÕRPÝÜX]UX][H
    ][ÝÉ][ÝÊBÕRTÙ]Ý]H

BÌÍÐÛÛXH^[Ù]ÛÛÜ
K   ÌÍÝXBÛÛÛÛUÜ]J   ÌÎNÌ ÌÎNÈ [È^
    ÌÍÐÛÛX
JBÚ[HB ÌÍÛÙÈHÕRQÙ]ÙÊ
BY  ÌÍÛÙÈH ÌÍÑÕRWÑUSÐÓÔÑH[^]ÛÜÙ[

Share this post


Link to post
Share on other sites
Yashied
DCCD

I'm sorry to tell you "Melba23, Yashied", but this just won't work

===========================================================

Melba23

\TabGetColor2.au3 (11) : ==> Incorrect number of parameters in function call.:

===========================================================

$iTab_Colour = '0x' & StringRight(Hex(PixelGetColor(0, 0, $hTab)), 6)

$iTab_Colour = '0x' & StringRight(Hex(^ ERROR

===========================================================

###########################################################

===========================================================

Yashied

\TabGetColor3.au3 (11) : ==> Incorrect number of parameters in function call.:

===========================================================

$ColTab = PixelGetColor(5, 20, $tab)

$ColTab = ^ ERROR

===========================================================

And I Am still interested..

Share this post


Link to post
Share on other sites
Yashied

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.