Jump to content

label over graphic: can change font but not color


orbs
 Share

Go to solution Solved by HeJake,

Recommended Posts

hello all,

i create a graphic rectangle, then i place a label in it. i can change the label font weight and background color, but i can not change the label text color.

this is a small reproducer:

#include <GUIConstantsEx.au3>

GUICreate('Block demo',400,200)
GUISetBkColor(0xCCDDEE)
GUICtrlCreateBlock('Title Of Block',20,20,300,100)
GUICtrlCreateLabel('Text Inside Block',25,50)
GUICtrlSetBkColor(-1,$GUI_BKCOLOR_TRANSPARENT)
GUISetState()

Global $msg=0
While $msg<>$GUI_EVENT_CLOSE
    $msg=GUIGetMsg()
WEnd

Func GUICtrlCreateBlock($sTitle,$x,$y,$w,$h)
    Local Const $cOutline=0x000000
    Local Const $cBlockBG=0xFFFFFF
    Local Const $cTitle=0x0000EE
    Local Const $cTitleBG=0x999999
    GUICtrlCreateGraphic($x-1,$y-1,$w+2,$h+2)
    GUICtrlSetState(-1,$GUI_DISABLE)
    GUICtrlSetGraphic(-1,$GUI_GR_COLOR,$cOutline,$cTitleBG)
    GUICtrlSetGraphic(-1,$GUI_GR_RECT,-1,-1,$w+2,27)
    GUICtrlSetGraphic(-1,$GUI_GR_COLOR,$cOutline,$cBlockBG)
    GUICtrlSetGraphic(-1,$GUI_GR_RECT,-1,25,$w+2,$h+2-25)
    GUICtrlCreateLabel($sTitle,$x+5,$y+3,$w-10,20)
    GUICtrlSetFont(-1,8.5,800)
    GUICtrlSetColor(-1,$cTitle)
    GUICtrlSetBkColor(-1,$cTitleBG)
    GUICtrlSetState(-1,$GUI_DISABLE)
EndFunc
 

this is the result: the label text color is shady white, while it should be blue:

post-47848-0-04454500-1379183391_thumb.p

what am i doing wrong?

 

Signature - my forum contributions:

Spoiler

UDF:

LFN - support for long file names (over 260 characters)

InputImpose - impose valid characters in an input control

TimeConvert - convert UTC to/from local time and/or reformat the string representation

AMF - accept multiple files from Windows Explorer context menu

DateDuration -  literal description of the difference between given dates

Apps:

Touch - set the "modified" timestamp of a file to current time

Show For Files - tray menu to show/hide files extensions, hidden & system files, and selection checkboxes

SPDiff - Single-Pane Text Diff

 

Link to comment
Share on other sites

  • Solution

U forgot to change GUICtrlSetState(-1,$GUI_DISABLE) to GUICtrlSetState(-1,$GUI_ENABLE)

#include <GUIConstantsEx.au3>

GUICreate('Block demo',400,200)
GUISetBkColor(0xCCDDEE)
GUICtrlCreateBlock('Title Of Block',20,20,300,100)
GUICtrlCreateLabel('Text Inside Block',25,50)
GUICtrlSetBkColor(-1,$GUI_BKCOLOR_TRANSPARENT)
GUISetState()

Global $msg=0
While $msg<>$GUI_EVENT_CLOSE
    $msg=GUIGetMsg()
WEnd

Func GUICtrlCreateBlock($sTitle,$x,$y,$w,$h)
    Local Const $cOutline=0x000000
    Local Const $cBlockBG=0xFFFFFF
    Local Const $cTitle=0x0000EE
    Local Const $cTitleBG=0x999999
    GUICtrlCreateGraphic($x-1,$y-1,$w+2,$h+2)
    GUICtrlSetState(-1,$GUI_DISABLE)
    GUICtrlSetGraphic(-1,$GUI_GR_COLOR,$cOutline,$cTitleBG)
    GUICtrlSetGraphic(-1,$GUI_GR_RECT,-1,-1,$w+2,27)
    GUICtrlSetGraphic(-1,$GUI_GR_COLOR,$cOutline,$cBlockBG)
    GUICtrlSetGraphic(-1,$GUI_GR_RECT,-1,25,$w+2,$h+2-25)
    GUICtrlCreateLabel($sTitle,$x+5,$y+3,$w-10,20)
    GUICtrlSetFont(-1,8.5,800)
    GUICtrlSetColor(-1,$cTitle)
    GUICtrlSetBkColor(-1,$cTitleBG)
    GUICtrlSetState(-1,$GUI_ENABLE)
EndFunc

:D

Link to comment
Share on other sites

force of habit i guess, i usually disable all objects if they are not supposed to be clicked... thank you!

Signature - my forum contributions:

Spoiler

UDF:

LFN - support for long file names (over 260 characters)

InputImpose - impose valid characters in an input control

TimeConvert - convert UTC to/from local time and/or reformat the string representation

AMF - accept multiple files from Windows Explorer context menu

DateDuration -  literal description of the difference between given dates

Apps:

Touch - set the "modified" timestamp of a file to current time

Show For Files - tray menu to show/hide files extensions, hidden & system files, and selection checkboxes

SPDiff - Single-Pane Text Diff

 

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