Bar after Radio or Checkbox Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
Noo0B
Posts: 151
Joined: 26 Jan 2018, 19:54

Bar after Radio or Checkbox

20 May 2018, 09:13

Hello,
I tried to make a few radio buttons next to each other but found that every radio has a little bar to its right that covers the next radio.
Two commas for the radio text parameter shortens that bar by half size, but it still covers the next radio.
Clicking the bar in front of the radio to the right will activate the left radio.
Does anyone know a workaround for this?
Thanks in advance!
User avatar
Hellbent
Posts: 2109
Joined: 23 Sep 2017, 13:34

Re: Bar after Radio or Checkbox

20 May 2018, 09:26

This sounds like a spacing problem.
Try this:
set your first radio the same way you are doing it now, and for your other radios, set the x position to "x+10"

Sort of like this

Code: Select all

Gui,add,radio,x10 ,rad1
Gui,add,radio,x+10,rad2
Gui,add,radio,x+10,rad3
Noo0B
Posts: 151
Joined: 26 Jan 2018, 19:54

Re: Bar after Radio or Checkbox

20 May 2018, 14:20

Hi bud,
thanks for the reply.
I've seen your youtube videos showing this, but it didn't remember to try it.
I used set coordinates like x10, x20, etc.
I wish i hadn't changed my gui doubling the size of the background image so i could try that.
I'm going to write a test gui with your insructions and set coordinates, both with and without the ",," and report the results here.
Thanks again!
Noo0B
Posts: 151
Joined: 26 Jan 2018, 19:54

Re: Bar after Radio or Checkbox

20 May 2018, 14:50

Here's the results of my test:
The radio does show the little bar to its right regardless of coordinates.
Adding an empty text parameter ",," reduces that bar by half, from around 20 pixels to 10.
Addon coordinates are respective to that bar, not the radio position.
Fixed coordinates placed the radios on top of that bar, unlikely my original script, where the bar would cover the next radio to its right.
Hovering the mouse over a radio makes its bar cover the next radio to its right.
This seems to be related to the text parameter.
I have noticed checkboxes behave similarly.
I believe AHK code reserves a double space for its text parameter when its not present, and a single space when the user inputs an empty parameter ",,".
Maybe this can help with the next AHK version since this seems to be unintended.
Best Regards!
User avatar
Hellbent
Posts: 2109
Joined: 23 Sep 2017, 13:34

Re: Bar after Radio or Checkbox

20 May 2018, 17:58

Are you putting the radios on a picture background? If so, set the radios with the option "BackgroundTrans".
just me
Posts: 9453
Joined: 02 Oct 2013, 08:51
Location: Germany

Re: Bar after Radio or Checkbox  Topic is solved

21 May 2018, 02:34

I'm successfully using

Code: Select all

SysGet, SGW, 71 ; SM_CXMENUCHECK
to restrict the width and height of Radios and Checkboxes:

Code: Select all

#NoEnv
SysGet, SGW, 71 ; SM_CXMENUCHECK
Gui, Color, Black
Gui, Margin, 100, 50
Gui, Add, Radio, xm ym w%SGW% h%SGW% vRadio1 gRadioLabel
Gui, Add, Radio, x+0 yp wp hp vRadio2 gRadioLabel
Gui, Add, Radio, x+0 yp wp hp vRadio3 gRadioLabel
Gui, Add, Radio, x+0 yp wp hp vRadio4 gRadioLabel
Gui, Add, Checkbox, x+0 yp wp hp vCheck1 gCheckLabel
Gui, Show, , Radio Test
Return

GuiClose:
ExitApp

RadioLabel:
   MsgBox, 0, %A_ThisLabel%, You selected %A_GuiControl%
Return

CheckLabel:
   GuiControlGet, Check1
   MsgBox, 0, %A_ThisLabel%, % "You " . (CHeck1 ? "" : "de") . "selected " . A_GuiControl
Return
Noo0B
Posts: 151
Joined: 26 Jan 2018, 19:54

Re: Bar after Radio or Checkbox

28 May 2018, 18:43

Hi,
Thanks for the replies.

Hellbent, unfortunately using BackgroundTrans did not make the little boxes transparent to the picture here.
Setting a color together with the picture showed they are transparent to the color only, with or without using the parameter like I did.
I might have used the option at the wrong location; I tried around the coordinates.

just me, I tried your approach, and after wasting a little time on doubled file edits and what not, I finally succeded.
Your approach was very easy to understand.
Also, nice example with the "selected" and "deselected" toggle function.

Thank you both for your efforts.
Kind regards!

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Joey5 and 335 guests