[v2.0-a108] Simple __Enum example please Topic is solved

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.
RogerWilcoNL
Posts: 17
Joined: 13 Nov 2019, 10:41

[v2.0-a108] Simple __Enum example please

02 Jan 2020, 07:08

Code: Select all

I made a class based on an object.
The values off all key-value pairs are objects themselves, from which i need a specific key (as a value). So there is an extra level.
 Now I need to iterate through all the keys and retrieve the keys and the spec. value of the objects
example: this.%Key% := {"Nm":Name,"Dt":NeededValue}
Can someone show me how to write the __Enum method to achieve this?
And for the learning curve: with AND without fat-arrow notation 
User avatar
lvalkov
Posts: 56
Joined: 08 Mar 2019, 16:39

Re: [v2.0-a108] Simple __Enum example please  Topic is solved

05 Jan 2020, 15:38

For a primer on enumerators, click here.
As a direct result of the unclear layout of your object and poorly defined expectations as to what data the enumerator is meant to enumerate, unfortunately, I am unable to further assist you in implementing an __Enum method.
RogerWilcoNL
Posts: 17
Joined: 13 Nov 2019, 10:41

Re: [v2.0-a108] Simple __Enum example please

06 Jan 2020, 06:56

@Ivalkov: That's exactly what I was missing. A Set of examples on __Enum.
Thank you very much for the trouble...
User avatar
lvalkov
Posts: 56
Joined: 08 Mar 2019, 16:39

Re: [v2.0-a108] Simple __Enum example please

06 Jan 2020, 18:04

I reckon simply delegating to the OwnProps() enumerator might suffice in your particular case.

Code: Select all

class ...
{
    __Enum(*) => this.OwnProps()
}

for key, Spec in ClassInstance
{
	... key ...
	... Spec.Nm ...
	.... Spec.Dt ...
}
RogerWilcoNL
Posts: 17
Joined: 13 Nov 2019, 10:41

Re: [v2.0-a108] Simple __Enum example please

07 Jan 2020, 02:29

Thanks again, its more complicated, but I'm almost there.

Return to “AutoHotkey v2 Help”

Who is online

Users browsing this forum: No registered users and 3 guests