Jump to content
Sign in to follow this  
Testy

Radio button background

Recommended Posts

Testy

I have tried more than a few items and read the help file and read through the forums. Promise.

I can't get the switch correct, if it is even possible. This is a estetic want, not a fucntional need.

; Radio Buttons
GuiCtrlCreateLabel("Program:", 15, 133)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
    $radio1 = GuiCtrlCreateRadio("Live", 115, 130, 40)
    GuiCtrlSetState(-1, $GUI_CHECKED)
GUICtrlSetBkColor($radio1, $GUI_BKCOLOR_TRANSPARENT)    
    $radio2 = GuiCtrlCreateRadio("Odd", 165, 130, 40)
    $radio3 = GuiCtrlCreateRadio("Even", 215, 130, 40)
    GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
GUICtrlCreateGroup ("",-99,-99,1,1);close group

I have tried a few things with no change. Making the Lable transparent, no problem.

Edited by Testy

Share this post


Link to post
Share on other sites
martin

I have tried more than a few items and read the help file and read through the forums. Promise.

I can't get the switch correct, if it is even possible. This is a estetic want, not a fucntional need.

; Radio Buttons
GuiCtrlCreateLabel("Program:", 15, 133)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
    $radio1 = GuiCtrlCreateRadio("Live", 115, 130, 40)
    GuiCtrlSetState(-1, $GUI_CHECKED)
GUICtrlSetBkColor($radio1, $GUI_BKCOLOR_TRANSPARENT)    
    $radio2 = GuiCtrlCreateRadio("Odd", 165, 130, 40)
    $radio3 = GuiCtrlCreateRadio("Even", 215, 130, 40)
    GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
GUICtrlCreateGroup ("",-99,-99,1,1);close group

I have tried a few things with no change. Making the Lable transparent, no problem.

Without mpore code I'm not certain what your problem is. Perhaps you have a pic as the gui background. You can always have no text for the radio button and place a label next to it which is transparent. Would that do what you want?

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
Share on other sites
Valuater

You can try this

#include <GUIConstantsEx.au3>

Dim $XS_n

GUICreate("My GUI")
XPStyle()

; If you use a large background pic, be sure to use the next line
;GUICtrlSetState( -1, $GUI_DISABLE)

; Radio Buttons
GuiCtrlCreateLabel("Program:", 15, 133)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
    $radio1 = GuiCtrlCreateRadio("Live", 115, 130, 40)
    GuiCtrlSetState(-1, $GUI_CHECKED)
GUICtrlSetBkColor($radio1, $GUI_BKCOLOR_TRANSPARENT)    
    $radio2 = GuiCtrlCreateRadio("Odd", 165, 130, 40)
    $radio3 = GuiCtrlCreateRadio("Even", 215, 130, 40)
    GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
GUICtrlCreateGroup ("",-99,-99,1,1);close group
XPStyle(0)
GUISetState()

While GUIGetMsg() <> -3
WEnd

; Control XP Style for Colors

; Author gafrost /Valuater

 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

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites
Testy

This is what I get:

Posted Image

I have tried both suggestions with the same result.

Share this post


Link to post
Share on other sites
Valuater

Adjust as needed

;^) 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)

;^) 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

this...

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

is the important part

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites
Testy

Heres what I get when I add:

$radio1 = _GuiCtrlCreateRadio("Live", 115, 130, 40, $GUI_BKCOLOR_TRANSPARENT) ;No color added

With

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

I get:

Posted Image

With or without color to the text or even without text, the same shape remains. Don't get me wrong, it's an improvement. =)

Share this post


Link to post
Share on other sites
Testy

So basically, it's not possible? If not, I will give up the holy grail on this.

Share this post


Link to post
Share on other sites
Valuater

So basically, it's not possible? If not, I will give up the holy grail on this.

Post the code and the pic in a zip file, i dont need all the code, just the gui up to the while wend loop and the background pic

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  

×