How to submit the GUI to get the value of the controls

Get help for the alpha version of AutoHotkey v2 here. Please state the v2 version you are working with in the title when making a new topic.
poetbox
Posts: 106
Joined: 18 Apr 2018, 20:47

How to submit the GUI to get the value of the controls

22 Jul 2020, 05:25

---------------------------
AutoHotkeyU64.exe
---------------------------
Error: This value of type "String" has no method named "Submit".

Line#
---> 029: NamedCtrlContents := Gui.Submit()

The current thread will exit.
---------------------------
OK
---------------------------
swagfag
Posts: 4145
Joined: 11 Jan 2017, 17:59

Re: How to submit the GUI to get the value of the controls

22 Jul 2020, 06:43

Gui is a reserved keyword, so u should have gotten a very different error long before that

Code: Select all

G := Gui.New()
G.Add('Edit', 'vEdit1', 'asdffasf')
NamedCtrlContents := G.Submit()
MsgBox NamedCtrlContents.Edit1
poetbox
Posts: 106
Joined: 18 Apr 2018, 20:47

Re: How to submit the GUI to get the value of the controls

23 Jul 2020, 22:48

@swagfag

Code: Select all

G := Gui.New()
G.Add('Edit', 'vEdit1', 'asdffasf')
NamedCtrlContents := G.Submit()
MsgBox NamedCtrlContents.Edit1
The four lines of code are still reporting errors as belove.

---------------------------
AutoHotkeyU64.exe
---------------------------
Error: This value of type "String" has no method named "New".

Line#
---> 001: G := Gui.New()

The current thread will exit.
---------------------------
OK
---------------------------

version:Version 2.0-a108-a2fa0498
:headwall:
guest3456
Posts: 3163
Joined: 09 Oct 2013, 10:31

Re: How to submit the GUI to get the value of the controls

24 Jul 2020, 00:36

poetbox wrote:
23 Jul 2020, 22:48
version:Version 2.0-a108-a2fa0498
:headwall:
if you're going to use an old version, then you need to use the correct syntax for that old version

with a108 you need to use GuiCreate() function.

Gui.New() wasn't added until a112:
https://www.autohotkey.com/boards/viewtopic.php?p=337056#p337056

Code: Select all

G := GuiCreate()
G.Add('Edit', 'vEdit1', 'asdffasf')
NamedCtrlContents := G.Submit()
MsgBox NamedCtrlContents.Edit1

poetbox
Posts: 106
Joined: 18 Apr 2018, 20:47

Re: How to submit the GUI to get the value of the controls

24 Jul 2020, 05:02

Thank you!
I don't know if swagfag and guest3456 are the same person,I should accept one answer to mark the topic as Solved.
swagfag
Posts: 4145
Joined: 11 Jan 2017, 17:59

Re: How to submit the GUI to get the value of the controls

24 Jul 2020, 06:29

then accept the one that solved it(if any)

always specify versions, unless ure running the latest one. otherwise, the latest is assumed

Return to “AutoHotkey v2 Help”

Who is online

Users browsing this forum: Kapitano and 5 guests