Jump to content

Radio button obscures controls near it and its text on the right side.


AndyS19
 Share

Recommended Posts

I created 3 radio buttons and when the script is run, the selected buttons display the text on the right of the actual button.  Also, it appears like the radio button occupies space around it, as it obscures part of the other controls when I hover the mouse around it.  I would like to group the buttons closer together and put other controls on the right of them.  I also wanted to make the button text display on the left side of the button.

Here is my test code:

#AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
Opt("GUICloseOnESC", 1) ; ESC closes GUI? (0 = no, 1 = yes)
Opt("GUIOnEventMode", 1) ; Change to OnEvent mode
Opt('MustDeclareVars', 1)
OnAutoItExitRegister("ExitStageLeft")
Opt("GUIEventOptions", 1) ;0=default, 1=just notification, 2=GuiCtrlRead tab index

_Main()

Func _Main()
    GUICreate("test", 300, 300, -1, -1, -1, -1)

    GUIStartGroup()
    local $x = 50, $y = 10, $w = 40, $h = 15,$spcY = 15
    GUICtrlCreateRadio("",     $x, $y,             $w, $h)
    GUICtrlCreateRadio("ABC",  $x, $y + ($spcY*1), $w, $h)
    GUICtrlCreateRadio("",     $x, $y + ($spcY*2), $w, $h)
    GUIStartGroup()

    GUICtrlCreateInput("An Input Control",      70, 10, 110, 30)
    GUICtrlCreateInput("Another Input Control", 10, 73, 110, 20)

    GUISetOnEvent(-3, 'ExitStageLeft')
    GUISetState(@SW_SHOW)

    While (1)
        Sleep(251)
    WEnd
EndFunc

Func ExitStageLeft()
    Exit
EndFunc

I want "ABC" to display on the left of the 2nd radio button.

 

24.png

Link to comment
Share on other sites

Great!  That worked.

my new code:

#include <StaticConstants.au3>

#AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
Opt("GUICloseOnESC", 1) ; ESC closes GUI? (0 = no, 1 = yes)
Opt("GUIOnEventMode", 1) ; Change to OnEvent mode
Opt('MustDeclareVars', 1)
OnAutoItExitRegister("ExitStageLeft")
Opt("GUIEventOptions", 1) ;0=default, 1=just notification, 2=GuiCtrlRead tab index

_Main()

Func _Main()
    GUICreate("test", 300, 300, -1, -1, -1, -1)

    GUIStartGroup()
    Local $x = 50, $y = 10, $w = 20, $h = 18, $spcY = 15

    GUICtrlCreateRadio("", $x, $y, $w, $h)

    GUICtrlCreateLabel("ABC", $x-40, $y + ($spcY * 1) + 3, 35, 20, $SS_RIGHT)
    GUICtrlCreateRadio("", $x, $y + ($spcY * 1), $w, $h)

    GUICtrlCreateRadio("", $x, $y + ($spcY * 2), $w, $h)
    GUIStartGroup()

    GUICtrlCreateInput("An Input Control", 70, 10, 110, 30)
    GUICtrlCreateInput("Another Input Control", 10, 73, 110, 20)

    GUISetOnEvent(-3, 'ExitStageLeft')
    GUISetState(@SW_SHOW)

    While (1)
        Sleep(251)
    WEnd
EndFunc   ;==>_Main

Func ExitStageLeft()
    Exit
EndFunc   ;==>ExitStageLeft

 

Link to comment
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
 Share

×
×
  • Create New...