Determine whether a control is visible or not

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
OnlyMe
Posts: 9
Joined: 29 Mar 2020, 04:20

Determine whether a control is visible or not

26 Nov 2021, 10:30

Hello guys,

I have some controls on my Gui and now I would like to determine
their visibility. According to the help this should work like this:
https://www.autohotkey.com/docs/commands/ControlGet.htm#Visible

Code: Select all

F11::
ControlGet, outputVar,visible,,Button1
MsgBox % outputvar
return
Unfortunately it doesn't. What am I doing wrong?
User avatar
Smile_
Posts: 858
Joined: 03 May 2020, 00:51

Re: Determine whether a control is visible or not

26 Nov 2021, 11:38

You didn't specify the WinTitle parameter
Use GuiControlGet instead if you are using an AHK GUI.
OnlyMe
Posts: 9
Joined: 29 Mar 2020, 04:20

Re: Determine whether a control is visible or not

26 Nov 2021, 12:39

OK, thanks.

Yet I'm getting 1 despite my Button1 is hidden on my Gui.

Code: Select all

Gui Add, Button, x10 y10, w50 h30 hide vButton1, Test1

Code: Select all

GuiControlGet, OutputVar,Visible, Button1 ; this can't be right
MsgBox % outputvar
just me
Posts: 9453
Joined: 02 Oct 2013, 08:51
Location: Germany

Re: Determine whether a control is visible or not

27 Nov 2021, 04:38

The option to initially hide a control is spelled Hidden. If you use Hide instead after the h (height) option, it will be interpreted as h not followed by a valid number and therefore h0. According to GuiControlGet a control with a height of 0 is 'visible'.
User avatar
boiler
Posts: 16930
Joined: 21 Dec 2014, 02:44

Re: Determine whether a control is visible or not

27 Nov 2021, 04:47

@OnlyMe meets @just me:

image.jpeg
image.jpeg (77.35 KiB) Viewed 926 times
just me
Posts: 9453
Joined: 02 Oct 2013, 08:51
Location: Germany

Re: Determine whether a control is visible or not

27 Nov 2021, 09:34

@boiler: There can be only one!

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: No registered users and 250 guests