Search found 266 matches

by cyruz
27 Feb 2019, 10:06
Forum: Scripts and Functions
Topic: [CLASS] MouseTracker - Track mouse on GUIs/Controls
Replies: 9
Views: 390

Re: [CLASS] MouseTracker - Track mouse on GUIs/Controls

Ok, I added multi handle tracking. New version in the OP. Regarding that change Helgef, I get an error in the boundfunc object inside the onmessage function if I implement it as in-class method. I'm trying to understand why. EDIT: OOOPS, new version again, fixed a small but critical issue, as per ch...
by cyruz
27 Feb 2019, 08:31
Forum: Scripts and Functions
Topic: [CLASS] MouseTracker - Track mouse on GUIs/Controls
Replies: 9
Views: 390

Re: [CLASS] MouseTracker - Track mouse on GUIs/Controls

Helgef wrote:
27 Feb 2019, 07:41
...
Thanks, I'm trying to adapt it for multi handle tracking.

Regarding the OnMessage stuff, although it's mostly for aesthetics, I will implement it in the next release, because I really like it :mrgreen:


Cheers.
by cyruz
27 Feb 2019, 04:06
Forum: Scripts and Functions
Topic: [CLASS] MouseTracker - Track mouse on GUIs/Controls
Replies: 9
Views: 390

Re: [CLASS] MouseTracker - Track mouse on GUIs/Controls

swagfag wrote:
27 Feb 2019, 03:42
...
Hi swagfag, thanks for spotting that error. The correct var is TME_CBSIZE, I guess this was causing heap corruption, can you try again?

Regarding LocalAlloc, I just keep the pointer for freeing memory later. No any particular reason.
by cyruz
26 Feb 2019, 21:37
Forum: Scripts and Functions
Topic: [CLASS] MouseTracker - Track mouse on GUIs/Controls
Replies: 9
Views: 390

[CLASS] MouseTracker - Track mouse on GUIs/Controls

Hi guys, the following class tries to standardize mouse tracking on GUIs and Controls. I started it using a combination of WM_MOUSEMOVE - WM_MOUSEHOVER - WM_MOUSELEAVE messages, but I soon realized that WM_MOUSEHOVER is just adding complexity to the code, without real advantages for a simple trackin...
by cyruz
17 Feb 2019, 10:51
Forum: Scripts and Functions
Topic: [CLASS] ClassHook - Generalized class method hooking
Replies: 3
Views: 203

Re: [CLASS] ClassHook - Generalized class method hooking

What is a practical application of this? I mean, why did you make it? I've seen hooks (callbacks, I think are the same thing?) in other languages. In my case I'm writing a library to manage logging and it became quite complex because I implemented also a notifier, a logrotator and a sort of schedul...
by cyruz
17 Feb 2019, 09:00
Forum: Scripts and Functions
Topic: [CLASS] ClassHook - Generalized class method hooking
Replies: 3
Views: 203

[CLASS] ClassHook - Generalized class method hooking

Hi guys, I came up with this code trying to generalize a way for a user to execute actions before/after a method execution. I commented it as much as I can. I think the usage should be clear. Class library: ; -------------------------------------------------------------------------------------------...
by cyruz
08 Feb 2019, 11:54
Forum: Ask For Help
Topic: Why nested class methods don't receive "this" object reference from parent class? Topic is solved
Replies: 22
Views: 598

Re: Why nested class methods don't receive "this" object reference from parent class? Topic is solved

swagfag wrote:
08 Feb 2019, 11:46
all of these still store circular references tho
I'm not sure about last one :geek:. Eventually the circular reference could be broken in method1 before returning.

What do you think Helgef?
by cyruz
08 Feb 2019, 11:35
Forum: Ask For Help
Topic: Why nested class methods don't receive "this" object reference from parent class? Topic is solved
Replies: 22
Views: 598

Re: Why nested class methods don't receive "this" object reference from parent class? Topic is solved

Yeah seems kinda unreliable. What about this then: global obj := new C obj.S.method1() return class C { __New() { this.var := "OH SHIT!" } __Get( aName ) { If ( aName == "S" ) Return new C.S(this) } class S { __New(outer) { this.outer := outer } method1() { msgbox % this.outer.var } } }
by cyruz
08 Feb 2019, 11:19
Forum: Ask For Help
Topic: Why nested class methods don't receive "this" object reference from parent class? Topic is solved
Replies: 22
Views: 598

Re: Why nested class methods don't receive "this" object reference from parent class? Topic is solved

Helgef wrote:
08 Feb 2019, 10:22
while creative, that is very dangerous. Consider what can happen if there is an interruption.

Cheers.
I guess the added reference could be managed in the __Delete method. Or are you referring to something else?

Cheers!
by cyruz
08 Feb 2019, 09:49
Forum: Ask For Help
Topic: Why nested class methods don't receive "this" object reference from parent class? Topic is solved
Replies: 22
Views: 598

Re: Why nested class methods don't receive "this" object reference from parent class? Topic is solved

Yes, I agree about the simplest way. But it's not interesting :D The solution with __Call I don't like it, because it implies calling the inner class method on the outer class object. I found that calling the inner class uses __Get, so this is what I got now: global obj := new C obj.S.method1() retu...
by cyruz
08 Feb 2019, 05:29
Forum: Ask For Help
Topic: Why nested class methods don't receive "this" object reference from parent class? Topic is solved
Replies: 22
Views: 598

Re: Why nested class methods don't receive "this" object reference from parent class? Topic is solved

parent.child is the invoking object. What do you you expect obj.child to return? obj ? No, you expect to get parent.child , and you do. So obj.child.method is parent.child.method , which is (parent.child).method . Cheers. Your point is clear, I got what the actual implementation is. I was questioni...
by cyruz
07 Feb 2019, 19:47
Forum: Ask For Help
Topic: Why nested class methods don't receive "this" object reference from parent class? Topic is solved
Replies: 22
Views: 598

Re: Why nested class methods don't receive "this" object reference from parent class? Topic is solved

For flexibility reasons I was expecting "method" to receive the object reference he is called on As documented, it does. The invoking object is parent.child though. You can pass this explicitly by obj.method.call(obj) . But in this specific case the invoking object is "obj". I would agree instead I...
by cyruz
07 Feb 2019, 06:00
Forum: Ask For Help
Topic: Why nested class methods don't receive "this" object reference from parent class? Topic is solved
Replies: 22
Views: 598

Re: Why nested class methods don't receive "this" object reference from parent class? Topic is solved

swagfag wrote:
07 Feb 2019, 05:45

Code: Select all

class child extends parent
It makes sense if I think that I need to manipulate the parent object and I evaluated this solution already. My only concern is that I have already a lot of code and this change would need to rethink most of it.
by cyruz
07 Feb 2019, 05:33
Forum: Ask For Help
Topic: Why nested class methods don't receive "this" object reference from parent class? Topic is solved
Replies: 22
Views: 598

Why nested class methods don't receive "this" object reference from parent class? Topic is solved

Hello guys, I was a little surprised by this behavior. obj := new parent obj.child.method() return class parent { __new() { this.var1 := "MERDA" } class child { method() { msgbox, % this.var1 ; shows nothing. } } } For flexibility reasons I was expecting "method" to receive the object reference he i...
by cyruz
09 Jan 2019, 21:18
Forum: Scripts and Functions
Topic: [func][v2] xDllCall - asynchronous DllCall
Replies: 4
Views: 407

Re: [func][v2] xDllCall - asynchronous DllCall

Hi Helgef,

can this be considered a reliable method to do multithreading?

I was browsing your code repo and found also threadFunc. How does this compare to it?

I found also other interesting stuff in the xlib repo, but the thing is quite complex :D :D

Thank you!
by cyruz
27 Dec 2018, 21:35
Forum: Tips and Tricks
Topic: OOP design patterns in AHK
Replies: 14
Views: 3329

Re: OOP design patterns in AHK

Sharing this, maybe can be useful for somebody: Name: Superglobal instance of class. AHK only: Yes. Description: Replace class superglobal variable with its object instance. Use-cases: Take advantage of meta functions when using static class method calling (e.g. to check if an object has been instan...
by cyruz
27 Dec 2018, 04:33
Forum: Ask For Help
Topic: Object reinstantiating itself Topic is solved
Replies: 13
Views: 464

Re: Object reinstantiating itself Topic is solved

nnnik wrote:
27 Dec 2018, 04:01
You would never assume that for any sort of object.
I get your point :geek:
by cyruz
26 Dec 2018, 21:59
Forum: Ask For Help
Topic: Object reinstantiating itself Topic is solved
Replies: 13
Views: 464

Re: Object reinstantiating itself Topic is solved

;Instead of changing the object the method changed the contents of the a variable ;the old object remains the same in any other places ;therefore this is no option for object orientation - since methods called on the object ;should have some effect on the object or its relatives rather than the var...
by cyruz
26 Dec 2018, 07:21
Forum: Ask For Help
Topic: Object reinstantiating itself Topic is solved
Replies: 13
Views: 464

Re: Object reinstantiating itself Topic is solved

Hello cyruz . Methods are stored as function references in the class object, so when you define the method Renew in the class body of Test , a function reference to this method is stored at Test.Renew . All methods defined in a class body gets the hidden this parameter as their first parameter auto...
by cyruz
26 Dec 2018, 04:16
Forum: Ask For Help
Topic: Object reinstantiating itself Topic is solved
Replies: 13
Views: 464

Re: Object reinstantiating itself Topic is solved

Hi Helgef,

first solution defeats the purpose of having a single class handling everything so I went for the second solution and it works flawlessly.

Can you explain the logic behind it? I find it difficult to grasp...

Thank you very much for your help :)

Go to advanced search