Jump to content
Sign in to follow this  
NeptuneIT

CheckBox Text Color

Recommended Posts

NeptuneIT

Can you change the color of the text for a checkbox?

Here's my code...

$lastLogon = GuiCtrlCreateCheckbox("Last Logon", 50, 100)
GUICtrlSetColor(-1,0xFFFFFF)

I've got a black background for my GUI so I wanted the text of the checkbox white but it doesn't seem to change anything. Any ideas?

Share this post


Link to post
Share on other sites
SmOke_N

No, you'll need to make a seperate label to do it.


Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Share this post


Link to post
Share on other sites
SmOke_N

Proof of concept of the above:

$Main = GUICreate('Test GUI', 200, 100)
$CheckBox1 = GUICtrlCreateCheckbox('Some Text', 10, 10, 80, 20)
$aCkBox = _GUICtrlCreateCheckbox('Some Text', 10, 30, 60, 20, 0xFF0000)
GUISetState()
While 1
    Switch GUIGetMsg()
        Case -3
            Exit
        Case $CheckBox1
            MsgBox(64, 'Info', 'You clicked the regular check box')
        Case $aCkBox[1]
            MsgBox(64, 'Info', 'You clicked the altered check box')
        Case $aCkBox[2]
            MsgBox(64, 'Info', "You clicked the altered check box's label")
    EndSwitch
WEnd

Func _GUICtrlCreateCheckbox($sText, $nLeft, $nTop, $nWidth, $nHeight, $nColor)
    Local $aCkBoxEx[3]
    $aCkBoxEx[1] = GUICtrlCreateCheckbox('', $nLeft, $nTop, -1, 0, -1, -1)
    $aCkBoxEx[2] = GUICtrlCreateLabel($sText, $nLeft + 20, $nTop + 3, $nWidth, $nHeight)
    GUICtrlSetColor($aCkBoxEx[2], $nColor)
    Return $aCkBoxEx
EndFuncoÝ÷ ØGb´ 趫{¦¦W­¢f¤z+ZrÙbæ«z¥j·!yÉ£"¶.¶ëBz¬µê̲®¶­s`¢b33c´ÖâÒuT7&VFRb33µFW7BuTb33²Â#¢b33c´6V6´&÷ÒuT7G&Ä7&VFT6V6¶&÷b33µ6öÖRFWBb33²ÂÂÂÂ#¢b33c¶6´&÷ÒôuT7G&Ä7&VFT6V6¶&÷b33µ6öÖRFWBb33²ÂÂ3ÂcÂ#Âdc¤uT6WE7FFR¥vÆR 7vF6uTvWD×6r 66RÓ0 W@ 66Rb33c´6V6´&÷ ×6t&÷cBÂb33´æfòb33²Âb33µ÷R6Æ6¶VBFR&VwVÆ"6V6²&÷b33² 66Rb33c¶6´&÷³Ð ×6t&÷cBÂb33´æfòb33²Âb33µ÷R6Æ6¶VBFRÇFW&VB6V6²&÷b33² 66Rb33c¶6´&÷³%Ð 6öçG&öÄ6Æ6²væBb33c´ÖâÂb33²b33²Âb33c¶6´&÷³Ò VæE7vF6¥tVæ@ ¤gVæ2ôuT7G&Ä7&VFT6V6¶&÷b33c·5FWBÂb33c¶äÆVgBÂb33c¶åF÷Âb33c¶åvGFÂb33c¶äVvBÂb33c¶ä6öÆ÷" Æö6Âb33c¶6´&÷W³5Ð b33c¶6´&÷W³ÒÒuT7G&Ä7&VFT6V6¶&÷b33²b33²Âb33c¶äÆVgBÂb33c¶åF÷ÂÓÂÂÓÂÓ b33c¶6´&÷W³%ÒÒuT7G&Ä7&VFTÆ&VÂb33c·5FWBÂb33c¶äÆVgB²#Âb33c¶åF÷²2Âb33c¶åvGFÂb33c¶äVvB uT7G&Å6WD6öÆ÷"b33c¶6´&÷W³%ÒÂb33c¶ä6öÆ÷" &WGW&âb33c¶6´&÷W¤VæDgVæ0

Edited by SmOke_N

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Share this post


Link to post
Share on other sites
NeptuneIT

Thanks SmOke_N...and thanks for the code as well!

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  

×