Page 1 of 1

GuiObject __Item documentation needs update

Posted: 23 Jun 2020, 23:10
by buliasz
In the documentation (build a112) for the GuiObject there is this part:
__Item
Retrieves the GuiControl object associated with the specified name, text, ClassNN or HWND.
GuiCtrlObj := Gui[Name]

But it actually doesn't work.
One of Gui.Add options parameters is this:
V: Sets the control's Name. Specify the name immediately after the letter V, which is not included in the name. For example, specifying vMyEdit would name the control "MyEdit".

So in my code I use it like this:

Code: Select all

myGui.Add("Text", "vctrlName", "X")
Despite above documentation I can't access this control by myGui["ctrlName"], but it seems myGui.ctrlName works. So probably documentation needs to be updated here.
EDIT: It works correctly, as @swagfag explained below.

Re: GuiObject __Item documentation needs update  Topic is solved

Posted: 23 Jun 2020, 23:37
by swagfag
I can't access this control by myGui["ctrlName"], but it seems myGui.ctrlName works
if anything, it should be the other way around

Code: Select all

myGui := Gui.New()
myGui.Add("Text", "vctrlName", "X")
myGui.Show()

MsgBox myGui["ctrlName"].Text ; X
MsgBox myGui.ctrlName.Text ; the value of type "Gui" has no property named "ctrlName"
which this a112 test confirms on my end

Re: GuiObject __Item documentation needs update

Posted: 27 Jun 2020, 20:05
by buliasz
Oh... you are right!
I've misunderstood the new logic of Gui :)
Sorry for false alarm.