Jump to content

"Tab control" GetColor?


Recommended Posts

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
Link to comment
Share on other sites

  • Moderators

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

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see 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

 

Link to comment
Share on other sites

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[^]ÛÜÙ[
Link to comment
Share on other sites

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

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