Info Posted February 18, 2008 Share Posted February 18, 2008 (edited) GUICtrlCreateCheckbox ("Lol", 50, 40, 100, 20) GUICtrlSetColor(-1, 0xFFFFFF) My background color is black, so I wanted to change the CheckBox'es text color to white. Doesn't work. Help? Edited February 18, 2008 by Info Link to comment Share on other sites More sharing options...
rasim Posted February 18, 2008 Share Posted February 18, 2008 GUICtrlCreateCheckbox ("Lol", 50, 40, 100, 20) GUICtrlSetColor(-1, 0xFFFFFF) My background color is black, so I wanted to change the CheckBox'es text color to white. Doesn't work. Help? Try this trick #include <GuiConstants.au3> $GUI = GUICreate("Test Script", 200, 100) GUISetBkColor(0x000000, $GUI) GUICtrlCreateLabel("LOL", 68, 42, 50, 17) GUICtrlSetColor(-1, 0xFFFFFF) GUICtrlCreateCheckbox ("", 50, 40, 14, 15) GUISetState(@SW_SHOW, $GUI) Do Until GUIGetMsg() = $GUI_EVENT_CLOSE Link to comment Share on other sites More sharing options...
Squirrely1 Posted February 18, 2008 Share Posted February 18, 2008 (edited) What version of Windows are you using? I looked in the AutoIt Help file under "GUICtrlSetColor" and found this caveat:Checkbox, Radio or Progress controls cannot be painted if the "Windows XP style" is used.Button controls are always painted in "Windows Classic style".Code-wise, checkboxes are actually buttons having a special style to them.I don't know which syle you might need to use for your GUI window to get white text for those checkboxes. Edited February 18, 2008 by Squirrely1 Das Häschen benutzt Radar Link to comment Share on other sites More sharing options...
Info Posted February 18, 2008 Author Share Posted February 18, 2008 (edited) Try this trick #include <GuiConstants.au3> $GUI = GUICreate("Test Script", 200, 100) GUISetBkColor(0x000000, $GUI) GUICtrlCreateLabel("LOL", 68, 42, 50, 17) GUICtrlSetColor(-1, 0xFFFFFF) GUICtrlCreateCheckbox ("", 50, 40, 14, 15) GUISetState(@SW_SHOW, $GUI) Do Until GUIGetMsg() = $GUI_EVENT_CLOSE That sucks =[ What version of Windows are you using? I looked in the AutoIt Help file under "GUICtrlSetColor" and found this caveat: Code-wise, checkboxes are actually buttons having a special style to them. I don't know which syle you might need to use for your GUI window to get white text for those checkboxes.You right, I switched the style to classic and it worked. I'll check if it works as an .exe file in WinXP style. EDIT: Not working, too bad for me. I guess I'll have to use rasim's trick... =[ Edited February 18, 2008 by Info Link to comment Share on other sites More sharing options...
Squirrely1 Posted February 18, 2008 Share Posted February 18, 2008 I thought of rasim's technique just about the time he posted it. I haven't tested his code but can guarantee that the workaround is typical of what we have to do in AutoIt sometimes. But this one isn't even radical in the least, there is no trickery involved - the saints while not smiling on it, would not condemn it. Perfectly legal. Das Häschen benutzt Radar Link to comment Share on other sites More sharing options...
rasim Posted February 18, 2008 Share Posted February 18, 2008 Info That sucks =[ Thank you for good words. Try this: #include <GuiConstants.au3> $GUI = GUICreate("Test Script", 200, 100) GUISetBkColor(0x000000, $GUI) $hCheckBox = GUICtrlCreateCheckbox ("Lol", 50, 40, 50, 15) GUICtrlSetColor(-1, 0xFFFFFF) DllCall("UxTheme.dll", "int", "SetWindowTheme", "hwnd", GUICtrlGetHandle($hCheckBox), "wstr", "", "wstr", "") GUISetState(@SW_SHOW, $GUI) Do Until GUIGetMsg() = $GUI_EVENT_CLOSE Link to comment Share on other sites More sharing options...
MrCreatoR Posted February 18, 2008 Share Posted February 18, 2008 http://www.autoitscript.com/forum/index.ph...st&p=480855 Spoiler Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1 AutoIt Russian Community My Work... Spoiler Projects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize ProgramUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF Examples: ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating ) * === My topics === * ================================================== ================================================== AutoIt is simple, subtle, elegant. © AutoIt Team Link to comment Share on other sites More sharing options...
Valuater Posted February 18, 2008 Share Posted February 18, 2008 The uses above actually change the XP settings, however this little UDF will do what you need and replace the users original settings #include <GUIConstants.au3> Dim $XS_n GUICreate("My GUI Checkbox") ; will create a dialog box that when displayed is centered GUISetBkColor(0x000000) If XPStyle(1) Then MsgBox(0,0,"on", 2) $checkCN = GUICtrlCreateCheckbox("CHECKBOX 1", 10, 10, 120, 15) GUICtrlSetColor($checkCN, 0xFF0000) GUICtrlSetBkColor($checkCN, 0x000000);0xFFFFFF) If XPStyle(0) Then MsgBox(0,0,"off", 2) GUISetState() ; will display an dialog box with 1 checkbox ; Run the GUI until the dialog is closed While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then ExitLoop WEnd Func XPStyle($OnOff = 1) If $OnOff And StringInStr(@OSTYPE, "WIN32_NT") Then $XS_n = DllCall("uxtheme.dll", "int", "GetThemeAppProperties") DllCall("uxtheme.dll", "none", "SetThemeAppProperties", "int", 0) Return 1 ElseIf StringInStr(@OSTYPE, "WIN32_NT") And IsArray($XS_n) Then DllCall("uxtheme.dll", "none", "SetThemeAppProperties", "int", $XS_n[0]) $XS_n = "" Return 1 EndIf Return 0 EndFunc ;==>XPStyle MSCreator knows this one too!!..?? ... there are more helpful snippets in Autoit Wrappers 8) Link to comment Share on other sites More sharing options...
MrCreatoR Posted February 19, 2008 Share Posted February 19, 2008 MSCreator knows this one too!!..??Yes sure, i pulled out from this example the line with DllCall Btw, i do not like much the idea of using Global declaration here, maybe this function should return the old theme value? Like this: #include <GUIConstants.au3> GUICreate("_SetThemeAppProperties Example", 200, 100) ; will create a dialog box that when displayed is centered GUISetBkColor(0x000000) $iOld_AppTheme = _SetThemeAppProperties(0) $CheckBox = GUICtrlCreateCheckbox("CHECKBOX", 60, 40, 120, 15) GUICtrlSetColor(-1, 0xFFFFFF) GUICtrlSetBkColor(-1, 0x000000) _SetThemeAppProperties($iOld_AppTheme) GUISetState() ; will display an dialog box with 1 checkbox ; Run the GUI until the dialog is closed While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd Func _SetThemeAppProperties($iTheme=0) If Not StringInStr(@OSTYPE, "WIN32_NT") Then Return 0 Local $a_Old_AppTheme = DllCall("uxtheme.dll", "int", "GetThemeAppProperties") If @error Then Return 0 DllCall("uxtheme.dll", "none", "SetThemeAppProperties", "int", $iTheme) If @error Then Return 0 Return $a_Old_AppTheme[0] EndFunc ;==>SetThemeAppProperties Spoiler Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1 AutoIt Russian Community My Work... Spoiler Projects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize ProgramUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF Examples: ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating ) * === My topics === * ================================================== ================================================== AutoIt is simple, subtle, elegant. © AutoIt Team Link to comment Share on other sites More sharing options...
Info Posted February 19, 2008 Author Share Posted February 19, 2008 Thank you all, really helped me. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now