Jump to content
Sign in to follow this  
pdaughe

GuiCtrlCreateRadio

Recommended Posts

pdaughe

Here is the example from the help file, modified only to include a GUICTRLSETCOLOR in an attempt to change the color of the radio control text. What's surprising it that I searched the forums and this apparently hasn't been reported. Am I missing something?

#include <GUIConstants.au3>
#include <Constants.au3>
GUICreate("My GUI radio") ; will create a dialog box that when displayed is centered

$radio1 = GUICtrlCreateRadio ("Radio 1", 10, 10, 120, 20)
$radio2 = GUICtrlCreateRadio ("Radio 2", 10, 40, 120, 20)
GUICtrlSetColor ($radio2, $Color_White)        ;--------------------- included statement
GUICtrlSetState ($radio2, $GUI_CHECKED)

GUISetState ()      ; will display an  dialog box with 1 checkbox

; Run the GUI until the dialog is closed
While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            ExitLoop
        Case $msg = $radio1 And BitAND(GUICtrlRead($radio1), $GUI_CHECKED) = $GUI_CHECKED
            MsgBox(64, 'Info:', 'You clicked the Radio 1 and it is Checked.')
        Case $msg = $radio2 And BitAND(GUICtrlRead($radio2), $GUI_CHECKED) = $GUI_CHECKED
            MsgBox(64, 'Info:', 'You clicked on Radio 2 and it is Checked.')
    EndSelect
Wend

I just downloaded v3.2.3.2 and it behaves the same as it did in the production version. By the way, v3.2.3.2 seems notably faster when switching/activating windows -- could be my imagination, but something has to be A LOT faster for it to be visually noticeable. Great job developers!

Share this post


Link to post
Share on other sites
pdaughe

Could someone else confirm this please?

Share this post


Link to post
Share on other sites
pdaughe

In addition, it seems that the text of a checkbox cannot be colored. Is this true for others?

Share this post


Link to post
Share on other sites
pdaughe

I work around is to just create a label following a very narrow radio control - does it work for anyone else?

Share this post


Link to post
Share on other sites
Holger

That is maybe again cause if you use a XP-Theme (non-classic).

Just use a function like:

Func SetThemeAppProperties($nFlags)
    DllCall("uxtheme.dll", "none", "SetThemeAppProperties", _
                                    "int", $nFlags)
EndFunc
oÝ÷ Ú)ò¢êìr¸©µ.q©ÜjYméí+ºw-ây·¢·­æ­x-á"X¤y«­¢+Ø(¸¸¸)MÑQ¡µÁÁAɽÁÉÑ¥Ì Ä¤()U%
ÉÑ ÅÕ½Ðí5äU$É¥¼ÅÕ½Ðì¤(¸¸¸

Additional info to SetThemeProperties-value:

0 = don't allow visual styles for all controls/nonclient areas

1 = allow for nonclient areas (like border, etc)

2 = allow for normal controls

4 = allow for web contents.

These values can be cominbed, so if you use a value 3 you will have the same results as before - no color for radio, so 1 is a good value so you can still have the XP theme style window.

Edited by Holger

Share this post


Link to post
Share on other sites
pdaughe

Thank you Holger, very much, for responding -- I was feeling all alone on this forum!

You not only responded, but gave a solution that works, just like you suggested.

Thanks again.

Paul

Share this post


Link to post
Share on other sites
alc

Hi everybody

@ pdaughe, Holger:

I found the same problem in these same days, see http://www.autoitscript.com/forum/index.php?showtopic=44117

Holger is right, it's the XP theme. But I want to add some info:

- In Win XP, the BUTTON text color doesn't change if using the official release, even without theme. The problem with official release exists in Win2000 SP4 and Win98 SE either. I don't have 2003 neither Vista to test. Beta release 3.2.3.5 works OK

- A script compiled with the beta release doesn't run in Win98SE. I mean, runs, but does nothing: no crash, no GUI, etc. May be this has been told in other place, I haven't seen. I deal with Win98SE sometimes, so, at least for me, this is important

Win98SE and Win2000SP4 ran in virtual machines (VirtualPC 5.1)

In case you wanna try, the attachment contains a simple testbed for radio, checkbox, button and group

That's all, bye

alc

caption_color_testbed.au3

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  

×