Sign in to follow this  
Followers 0
Ysengrim

Radiobuttons

18 posts in this topic

$Keuze[1] = GUICtrlCreateRadio (" Windows XP", 150, 110, 300, 20,)

$Keuze[2] = GUICtrlCreateRadio (" Windows Vista", 150, 140, 300, 20)

GUICtrlSetState ($Keuze[2], $GUI_CHECKED)

the function "GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)" isn't working but in the help files it seems that it has to work (extended styles)

can somehelp me how to change the color of the text and make the background transparant?

THANKS & happy newyear

Share this post


Link to post
Share on other sites



Hi,

With Checkbox/RadioButton there is a problem on set color/Bkcolor on Win XP... you can use a workaround:

#include <GuiConstants.au3>
Global $XS_n

$Gui = GuiCreate("Test")
GUISetBkColor(0x0)

XPStyleToggle(1)
$RadioButton = GUICtrlCreateRadio("Text", 20, 40, 40)
GUICtrlSetColor(-1, 0xFFFFFF)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
XPStyleToggle(0)

GUISetState()

While 1
    $Msg = GUIGetMsg()
    Switch $Msg
        Case $GUI_EVENT_CLOSE
            Exit
    EndSwitch
WEnd

Func XPStyleToggle($OnOff = 1)
    If Not StringInStr(@OSTYPE, "WIN32_NT") Then Return 0
    If $OnOff Then
        $XS_n = DllCall("uxtheme.dll", "int", "GetThemeAppProperties")
        DllCall("uxtheme.dll", "none", "SetThemeAppProperties", "int", 0)
        Return 1
    ElseIf IsArray($XS_n) Then
        DllCall("uxtheme.dll", "none", "SetThemeAppProperties", "int", $XS_n[0])
        $XS_n = ""
        Return 1
    EndIf
    Return 0
EndFunc

 

Spoiler

Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

AutoIt_Rus_Community.png AutoIt Russian Community

My Work...

Spoiler

AutoIt_Icon_small.pngProjects: 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 Program

AutoIt_Icon_small.pngUDFs: 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
 
AutoIt_Icon_small.pngExamples: 
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 AutoIt_Rating.gif)

* === My topics === *

==================================================
My_Userbar.gif
==================================================

 

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

Share this post


Link to post
Share on other sites

thank you for your reply

I added your code within mine but on the screen there is no difference to see

the text still remains black and the background remains grey

but thanks anyway !!!

Share this post


Link to post
Share on other sites

I added your code within mine but on the screen there is no difference to see

the text still remains black and the background remains grey

What system are you runing? can you show a screenshot of what you get (from my example)?


 

Spoiler

Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

AutoIt_Rus_Community.png AutoIt Russian Community

My Work...

Spoiler

AutoIt_Icon_small.pngProjects: 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 Program

AutoIt_Icon_small.pngUDFs: 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
 
AutoIt_Icon_small.pngExamples: 
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 AutoIt_Rating.gif)

* === My topics === *

==================================================
My_Userbar.gif
==================================================

 

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

Share this post


Link to post
Share on other sites

What system are you runing? can you show a screenshot of what you get (from my example)?

:^/ I'm running Windows® 2000, and from your script I get an AutoIt Error:

Line 18, Case $GUI_EVENT_CLOSE

Error: "Case" statement with no matching "Select" statement.

Share this post


Link to post
Share on other sites

There should be no error if you use the posted code from MSCreator

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites

:^/ Here's a screen shot of a demo I cooked up to show you. The background for each lable is grey, covering over the background image.

Posted Image

The background for radio button 2 uses the line:

GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)

-Which makes it white, instead of truly transparant. The background for radio button 3 uses the line:

GUICtrlSetBkColor(-1, $WS_EX_TRANSPARENT)

-Which makes it black, instead of truly transparent. I suspect that there is another flag that needs to be set, or something. The effect I want is for the text to appear with the backdrop visible behind the letters, instead of being masked out. The added text in the second image illustrates the concept, though I had to use a paint program to do it....

Posted Image

:^/ Soooo, how does one do that?

;^) Thanks.

Share this post


Link to post
Share on other sites

Post the code so i can have a look

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites

;^) Here's the code below. It's quick and dirty, and won't exit on its own, but it'll illustrate the concept.

;^) Demonstrate trouble with transparency.

;^) Let's create the GUI.=======================================================

#include <GUIConstants.au3>

GUICreate("Transparency", 265,295, @DesktopWidth/2-160, @DesktopHeight/2-90, -1, 0x00000218)

GUISetState(@SW_SHOW)

$BI = GUICtrlCreatePic ("Background.gif", 0, 0, 265, 295)

;^) Make a group.

$Group = GUICtrlCreateGroup ("Group", 10, 10, 100, 170)

;^) Radio buttons.

$radio1 = GUICtrlCreateRadio ("Radio 1", 20, 30, 80, 15)

$radio2 = GUICtrlCreateRadio ("Radio 2", 20, 50, 0, 0)

GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)

;^| White instead of transparent....

$radio3 = GUICtrlCreateRadio ("Radio 3", 20, 70, 0, 0)

GUICtrlSetBkColor(-1, $WS_EX_TRANSPARENT)

;^| Black instead of transparent....

$radio4 = GUICtrlCreateRadio ("Radio 4", 20, 90, 0, 0)

$radio5 = GUICtrlCreateRadio ("Radio 5", 20, 110, 0, 0)

$radio6 = GUICtrlCreateRadio ("Radio 6", 20, 130, 0, 0)

$radio7 = GUICtrlCreateRadio ("Radio 7", 20, 150, 0, 0)

;^) Buttons

$Butt1 = GUICtrlCreateButton ("One", 10, 263, 50, 20)

$Butt2 = GUICtrlCreateButton ("Two", 75, 263, 50, 20)

$Butt3 = GUICtrlCreateButton ("Three", 140, 263, 50, 20)

$Butt4 = GUICtrlCreateButton ("Four", 205, 263, 50, 20)

;^) List with label

GUICtrlCreateLabel("List", 130, 10, 80, 15)

$List=GUICtrlCreateList ("", 120, 25, 135, 227,$LBS_NoIntegralHeight)

;^) GUI is done.================================================================

While 1

Sleep(100)

Wend

Share this post


Link to post
Share on other sites

Try this

;^) Demonstrate trouble with transparency.
;^) Let's create the GUI.=======================================================
#include <GUIConstants.au3>

GUICreate("Transparency", 265,295, @DesktopWidth/2-160, @DesktopHeight/2-90, -1, 0x00000218)
GUISetState(@SW_SHOW)

$BI = GUICtrlCreatePic ("Background.gif", 0, 0, 265, 295)

;^) Make a group.
$Group = GUICtrlCreateGroup ("Group", 10, 10, 100, 170)

;^) Radio buttons.
$radio1 = _GUICtrlCreateRadio ("Radio 1", 20, 30, 80, 15, $GUI_BKCOLOR_TRANSPARENT, 0x00ff00) ; Green
$radio2 = _GUICtrlCreateRadio ("Radio 2", 20, 50, 80, 15, $GUI_BKCOLOR_TRANSPARENT, 0xFFFFFF) ; White
$radio3 = _GUICtrlCreateRadio ("Radio 3", 20, 70, 80, 15, $GUI_BKCOLOR_TRANSPARENT, 0xff0000) ; Red
$radio4 = _GUICtrlCreateRadio ("Radio 4", 20, 90, 80, 15, $GUI_BKCOLOR_TRANSPARENT)
$radio5 = _GUICtrlCreateRadio ("Radio 5", 20, 110, 80, 15, $GUI_BKCOLOR_TRANSPARENT)
$radio6 = _GUICtrlCreateRadio ("Radio 6", 20, 130, 80, 15, $GUI_BKCOLOR_TRANSPARENT)
$radio7 = _GUICtrlCreateRadio ("Radio 7", 20, 150, 80, 15, $GUI_BKCOLOR_TRANSPARENT)


;^) Buttons
$Butt1 = GUICtrlCreateButton ("One", 10, 263, 50, 20)
$Butt2 = GUICtrlCreateButton ("Two", 75, 263, 50, 20)
$Butt3 = GUICtrlCreateButton ("Three", 140, 263, 50, 20)
$Butt4 = GUICtrlCreateButton ("Four", 205, 263, 50, 20)

;^) List with label
GUICtrlCreateLabel("List", 130, 10, 80, 15)
$List=GUICtrlCreateList ("", 120, 25, 135, 227,$LBS_NoIntegralHeight)

;^) GUI is done.================================================================

While GUIGetMsg() <> -3
Wend

Func _GUICtrlCreateRadio( $rText, $rLeft, $rTop, $rLength, $rHieght, $rBackColor = "" , $rTextColor = "" )
    Local $PCRadio = GUICtrlCreateRadio("", $rLeft, $rTop, 15, 15)
    Local $PCLabel = GUICtrlCreateLabel($rText, $rLeft + 15, $rTop, $rLength - 15, $rHieght)
    If $rTextColor <> "" Then GUICtrlSetColor(-1, $rTextColor)
    If $rBackColor <> "" Then GUICtrlSetBkColor(-1, $rBackColor)
    Return $PCRadio
EndFunc

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites

Try this

[snip!]

8)

:^/ Thanks for that, but on my Win2000 machine I get this:

Posted Image

The background behind the radio text is still white instead of the background image showing through.

Share this post


Link to post
Share on other sites

What Version of Autoit are you using?

Hopefully someone with a Win2000 can help you

You will need to do this also

$BI = GUICtrlCreatePic ("Background.gif", 0, 0, 265, 295)
GUICtrlSetState( -1, $GUI_DISABLE)

or else the radios etc wont work

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites

;^) I'm using the latest version, version 3.

:^/ I'd have thought that if this were a bug, it'd have been noticed and fixed by now. Does your example work on your setup? Which OS are you using?

Share this post


Link to post
Share on other sites

Yes it works on mine

Windows Xp

Posted Image

With this code

;^) Demonstrate trouble with transparency.
;^) Let's create the GUI.=======================================================
#include <GUIConstants.au3>

MsgBox(0x0,"", @AutoItVersion)

GUICreate("Transparency", 265,295, @DesktopWidth/2-160, @DesktopHeight/2-90, -1, 0x00000218)
GUISetState(@SW_SHOW)

$BI = GUICtrlCreatePic ("C:\Temp\Backgrnd.jpg", 0, 0, 265, 295)
GUICtrlSetState( -1, $GUI_DISABLE)

;^) Make a group.
$Group = GUICtrlCreateGroup ("", 10, 10, 100, 170)

;^) Radio buttons.
$radio1 = _GUICtrlCreateRadio ("Radio 1", 20, 30, 80, 15, $GUI_BKCOLOR_TRANSPARENT, 0x00ff00) ; Green
$radio2 = _GUICtrlCreateRadio ("Radio 2", 20, 50, 80, 15, $GUI_BKCOLOR_TRANSPARENT, 0xFFFFFF) ; White
$radio3 = _GUICtrlCreateRadio ("Radio 3", 20, 70, 80, 15, $GUI_BKCOLOR_TRANSPARENT, 0xff0000) ; Red
$radio4 = _GUICtrlCreateRadio ("Radio 4", 20, 90, 80, 15, $GUI_BKCOLOR_TRANSPARENT)
$radio5 = _GUICtrlCreateRadio ("Radio 5", 20, 110, 80, 15, $GUI_BKCOLOR_TRANSPARENT)
$radio6 = _GUICtrlCreateRadio ("Radio 6", 20, 130, 80, 15, $GUI_BKCOLOR_TRANSPARENT)
$radio7 = _GUICtrlCreateRadio ("Radio 7", 20, 150, 80, 15, $GUI_BKCOLOR_TRANSPARENT)


;^) Buttons
$Butt1 = GUICtrlCreateButton ("One", 10, 263, 50, 20)
$Butt2 = GUICtrlCreateButton ("Two", 75, 263, 50, 20)
$Butt3 = GUICtrlCreateButton ("Three", 140, 263, 50, 20)
$Butt4 = GUICtrlCreateButton ("Four", 205, 263, 50, 20)

;^) List with label
GUICtrlCreateLabel("List", 130, 10, 80, 15)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
$List=GUICtrlCreateList ("", 120, 25, 135, 227,$LBS_NoIntegralHeight)

;^) GUI is done.================================================================

While GUIGetMsg() <> -3
Wend

Func _GUICtrlCreateRadio( $rText, $rLeft, $rTop, $rLength, $rHieght, $rBackColor = "" , $rTextColor = "" )
    Local $PCRadio = GUICtrlCreateRadio("", $rLeft, $rTop, 12, 12)
    Local $PCLabel = GUICtrlCreateLabel($rText, $rLeft + 15, $rTop, $rLength - 15, $rHieght)
    If $rTextColor <> "" Then GUICtrlSetColor(-1, $rTextColor)
    If $rBackColor <> "" Then GUICtrlSetBkColor(-1, $rBackColor)
    Return $PCRadio
EndFunc

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites

#15 ·  Posted (edited)

Yes it works on mine

Windows Xp

8)

:^/ I'm running version 3.1.1.0

Your new script gets an error code with the function

_GUICtrlCreateRadio

-it seems that it's an "Unknown Function Name." The underscore in front is different from my original script.

[Edit]

:^( I tried editing the undescores out. The script runs now, but now not only is the radio text background transparant, the radio text and radio gadgets themselves are transparent, as is the group label. As shown here:

Posted Image

:^/ That I could already do....

Edited by MisterPseudonym

Share this post


Link to post
Share on other sites

#16 ·  Posted (edited)

I added that Function to the bottom of the script to create the effect you wanted. By placing the "_" (underscore) it will use the UDF I created and not the Autoit command

thats the way the first script i posted was also

... update to the newest Autoit 3.2.10

8)

Edited by Valuater

NEWHeader1.png

Share this post


Link to post
Share on other sites

#17 ·  Posted (edited)

I added that Function to the bottom of the script to create the effect you wanted. By placing the "_" (underscore) it will use the UDF I created and not the Autoit command

thats the way the first script i posted was also

... update to the newest Autoit 3.2.10

8)

:^/ Okay, the script you posted was longer than the pane it appeared in, and I missed out the bit at the end. That's corrected now, and I put the underscores back. Now, the radio button text still has the white background, while the buttons themselves have separate gray backgrounds. The group label is still invisible. Screen shot in a minute.

[Edit]

Posted Image

I'll try the newest AutoIt, too.

[Edit 2]

:^o Hokey Smokes, Bullwinkle! That did it.

;^) Thanks, dude; I appreciate it.

:^/ The only trouble is that at work we have an earlier version. Any executable I create here should work fine there, but compiling the script there wouldn't work... But that's a separate challenge. Thanks for your help again.

[Edit 3]

:^( Wait... the backgrounds for the radio buttons themselves are still little gray squares...

Posted Image

:^/ Anyway, I'm happy enough for now. I've got other things to do today, so ciao for now!

Edited by MisterPseudonym

Share this post


Link to post
Share on other sites

All-Righty-Then!

lol

8)


NEWHeader1.png

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  
Followers 0