[v1/v2] Problem with __delete meta function for object associated with gui control event Topic is solved

Get help with using AutoHotkey and its commands and hotkeys
Helgef
Posts: 2472
Joined: 17 Jul 2016, 01:02
Contact:

[v1/v2] Problem with __delete meta function for object associated with gui control event

23 Sep 2017, 16:27

Hello :wave:
I'm having issues with the __delete meta function not being called for an object which has been set to handle a guiControl's events, see this script,

Code: [Select all] [Expand] [Download] GeSHi © Codebox Plus


Comment/uncomment the marked line to see the issue. Binding to a non-method function presents the same issue. I have the same problem with the corresponding v2 code.
Could someone explain my mistake to me, or why this happens? :eh:
Thanks for your time, cheers.
A_AhkUser
Posts: 610
Joined: 06 Mar 2017, 16:18
Location: France

Re: [v1/v2] Problem with __delete meta function for object associated with gui control event  Topic is solved

23 Sep 2017, 16:39

Hi Helgef,

I think it is necessary to free the object which has been set to handle a guiControl's events - i.e.:

Code: [Select all] [Expand] [Download] GeSHi © Codebox Plus

Video Game Reader
Image
github
demo
Helgef
Posts: 2472
Joined: 17 Jul 2016, 01:02
Contact:

Re: [v1/v2] Problem with __delete meta function for object associated with gui control event

23 Sep 2017, 16:47


Yeah, now that you say it I recognise this :facepalm: :lol:
Thanks!

Edit: For reference, this suffice,

Code: [Select all] [Download] GeSHi © Codebox Plus

gui.onEvent("close","f")

onGuiClose(hgui){
hgui.destroy()
}
A_AhkUser
Posts: 610
Joined: 06 Mar 2017, 16:18
Location: France

Re: [v1/v2] Problem with __delete meta function for object associated with gui control event

23 Sep 2017, 17:23

In truth, I hurry to reply; this was an opportunity: It was the world upside down, I think it is the first and last time I could help you. :lol:

ahk v1 version:

Code: [Select all] [Expand] [Download] GeSHi © Codebox Plus

Video Game Reader
Image
github
demo
Helgef
Posts: 2472
Joined: 17 Jul 2016, 01:02
Contact:

Re: [v1/v2] Problem with __delete meta function for object associated with gui control event

23 Sep 2017, 17:56

I mean gui.destroy() suffice for my purpose, guicontrol, -g, % btn is the general solution, we do not want to have to destroy the gui to release the object, in general. :wave:
It seems I cannot really do the equivalent in v2, I need to do guiCtrl.onEvent("eventName", referenceToTheObejct, 0), so I need to refrence the object when I unregister it for the event :think: :cry:. (Note: I don't know much about guis, take my statements with a pinch of salt and please correct me.)

Cheers.

Return to “Ask For Help”

Who is online

Users browsing this forum: Bing [Bot], Capn Odin, Odlanir and 44 guests