How to use Gui, +Object for object inside object? Topic is solved

Post AHK_H specific scripts & libraries and discuss the usage and development of HotKeyIt's fork/branch
kyuuuri
Posts: 340
Joined: 09 Jan 2016, 19:20

How to use Gui, +Object for object inside object?

Post by kyuuuri » 21 Apr 2020, 20:24

Introduction
Hello, I'm trying to use Gui, +Object to make each control go inside an object with properties Value and hwnd.

My code

Code: Select all

Test := []
Test.Name := []
Gui, +ObjectTest.Name
gui, add, edit, vValue hwndHwnd
Gui, +ObjectTest.Surname
gui, add, edit, vValue hwndHwnd
gui, show
return

f1::
gui, submit, nohide
msgbox % "Control's value: " Test[controlName].value
msgbox % "Control's hwnd: " Test[controlName].hwnd
return
What I Tried
1.
Gui, +ObjectTest.Name
Error: The following variable name contains an illegal character

2.

Code: Select all

; Doing it this way
Gui, +ObjectTest
gui, add, edit, vName.Value hwndHwnd

; and then accessing it like this:
msgbox % "Control's value: " Test.Name.value
msgbox % "Control's hwnd: " Test.Name.hwnd
Error: none
Values: empty

HotKeyIt
Posts: 2364
Joined: 29 Sep 2013, 18:35
Contact:

Re: How to use Gui, +Object for object inside object?  Topic is solved

Post by HotKeyIt » 21 Apr 2020, 20:34

Code: Select all

test:={name:[]}
temp:=test.name
Gui, +Objecttemp
gui, add, edit, vValue hwndHwnd,this is a test
Gui,Submit,NoHide

; and then accessing it like this:
msgbox % "Control's value: " Test.Name.value
msgbox % "Control's hwnd: " Test.Name.hwnd

Post Reply

Return to “AutoHotkey_H”