Search found 150 matches

by wpb
02 Apr 2024, 01:01
Forum: Ask for Help (v2)
Topic: Passing GUI events to another GUI / letting GUI events fall through
Replies: 14
Views: 458

Re: Passing GUI events to another GUI / letting GUI events fall through

@lexikos, this documentation you've added is absolutely fantastic. It's really got to the core of the issue(s) in a clear and consise way, and I for one appreciate it very much. A big thank you from me.
by wpb
30 Mar 2024, 02:54
Forum: Scripts and Functions (v2)
Topic: UIA v2
Replies: 368
Views: 52686

Re: UIA v2

@Descolada , thanks for the swift response.

I was actually wondering if it was possible to trigger the focus change event only on focus changes to cEl or its descendants, rather than on the whole tree. I thought perhaps that was the purpose of getting cEl in the example?
by wpb
29 Mar 2024, 19:19
Forum: Scripts and Functions (v2)
Topic: UIA v2
Replies: 368
Views: 52686

Re: UIA v2

@Descolada , as always thank you for the UIA library.

I think there may be an error in Example07_FocusChangedEvent.ahk, since the variable cEl is never used.
by wpb
26 Mar 2024, 10:04
Forum: Ask for Help (v2)
Topic: Passing GUI events to another GUI / letting GUI events fall through
Replies: 14
Views: 458

Re: Passing GUI events to another GUI / letting GUI events fall through

No, avoiding references to the GUI itself being passed indirectly back into the GUI (via an event handler or assigned property) is essential to avoid circular references. You can use bound functions and closures that refer to objects which don't directly or indirectly have any counted reference to ...
by wpb
25 Mar 2024, 12:40
Forum: Ask for Help (v2)
Topic: Passing GUI events to another GUI / letting GUI events fall through
Replies: 14
Views: 458

Re: Passing GUI events to another GUI / letting GUI events fall through

Let me thank you again, lexikos , for your detailed response. The extra information about the special case in Gui's __New() implementation explains it all! Thank you. Basically, avoiding function references or boundfunc objects in event handlers is essential to avoid circular references, it seems. I...
by wpb
23 Mar 2024, 12:09
Forum: Ask for Help (v2)
Topic: Passing GUI events to another GUI / letting GUI events fall through
Replies: 14
Views: 458

Re: Passing GUI events to another GUI / letting GUI events fall through

Thanks, lexikos , I really appreciate you taking the time to post an example. When I run it, everything works as I'd expect, other than that I thought I'd see the "... will be deleted" message when I x-ed (closed) the GUI, but I don't. Why isn't the destructor called? Also, is it subclassing the GUI...
by wpb
22 Mar 2024, 03:45
Forum: Ask for Help (v2)
Topic: Passing GUI events to another GUI / letting GUI events fall through
Replies: 14
Views: 458

Re: Passing GUI events to another GUI / letting GUI events fall through

Sure, I did consider a method in the main GUI class, which could be called from both the main GUI and the sub GUI, but the anonymous function was so neat and compact, I was lured in! However, I am plagued by circular references in my code. I'm starting to recognize when I introduce them, but often t...
by wpb
22 Mar 2024, 02:46
Forum: Ask for Help (v2)
Topic: Passing GUI events to another GUI / letting GUI events fall through
Replies: 14
Views: 458

Re: Passing GUI events to another GUI / letting GUI events fall through

Thanks, the -1 worked perfectly. Nice and simple. I hadn't spotted that in the docs before. I just wanted to do this so that the code for opening the submenu is all in one place. Now if I make changes to the way the main GUI opens the context menu, I don't also have to make the same changes to the s...
by wpb
21 Mar 2024, 07:43
Forum: Ask for Help (v2)
Topic: Passing GUI events to another GUI / letting GUI events fall through
Replies: 14
Views: 458

Re: Passing GUI events to another GUI / letting GUI events fall through

Thanks, lexikos - that's a good idea. I tried this, but it does nothing: SubGui.OnEvent("ContextMenu", this.test.Bind(this)) ... test(*) { currentMode := A_CoordModeMouse A_CoordModeMouse := "Screen" MouseGetPos(&x, &y) A_CoordModeMouse := currentMode PostMessage(0x7B, MainGui.Hwnd, (x & 0xFFFFFFFF)...
by wpb
19 Mar 2024, 03:36
Forum: Ask for Help (v2)
Topic: Passing GUI events to another GUI / letting GUI events fall through
Replies: 14
Views: 458

Passing GUI events to another GUI / letting GUI events fall through

Hi there, I have a main GUI which is a framework for various sub-GUIs. The main GUI listens for ContextMenu events: this.MainGui.OnEvent("ContextMenu", (*) => this.ContextMenu.Show()) I want the sub-GUIs to show the same context menu, but I'd rather avoid recoding the same line on the sub-GUIs. Is t...
by wpb
12 Mar 2024, 15:18
Forum: Scripts and Functions (v2)
Topic: UIA v2
Replies: 368
Views: 52686

Re: UIA v2

Thanks @Descolada - that's interesting. I'm downloading Accessibility Insights now! ;)
by wpb
12 Mar 2024, 11:28
Forum: Scripts and Functions (v2)
Topic: UIA v2
Replies: 368
Views: 52686

Re: UIA v2

@Descolada, thanks for your input (and for the brilliant library!). Your code works perfectly - it was the

Code: Select all

.DocumentRange.GetText()
part that I didn't realize I had to do. How did you determine that a simple

Code: Select all

.Value
wouldn't suffice?
by wpb
10 Mar 2024, 15:07
Forum: Scripts and Functions (v2)
Topic: UIA v2
Replies: 368
Views: 52686

Re: UIA v2

Hi there. Can anyone report if they've had any luck getting the UIA element of the formula bar in Excel? I tried this but to no avail:

Code: Select all

ExcelElement := UIA.ElementFromHandle("ahk_exe EXCEL.EXE")
FormulaBarElement := ExcelElement.FindElement({AutomationId:"FormulaBar"})
Thanks!
by wpb
07 Mar 2024, 02:40
Forum: Tutorials (v2)
Topic: Screen scaling, DPI, and making scripts work in different computers
Replies: 6
Views: 6245

Re: Screen scaling, DPI, and making scripts work in different computers

@Descolada, just wanted to say thank you for this. It's a tricky topic, and this is a great summary of the problem and potential solutions. Much appreciated.
by wpb
03 Mar 2024, 09:49
Forum: Ask for Help (v2)
Topic: Static methods in base class not accesssible in derived class via "this".
Replies: 11
Views: 384

Re: Static methods in base class not accesssible in derived class via "this".

Thanks for your thoughts. Understanding the object instantiation AHK uses is requiring a lot more power than I'm used to providing to my brain. Apologies if it takes a while to click. As for why the design is as it is, it's because: cExcel makes sense as a singleton object, because it encapsulates h...
by wpb
02 Mar 2024, 09:26
Forum: Ask for Help (v2)
Topic: Static methods in base class not accesssible in derived class via "this".
Replies: 11
Views: 384

Re: Static methods in base class not accesssible in derived class via "this".

Perhaps this will illustrate what I mean: x := cGSheetsAsDatabase() y := cExcelAsDatabase() doSomethingWithCellCoords(x) ; Works doSomethingWithCellCoords(y) ; Fails doSomethingWithCellCoords(instanceOfDatabase) { MsgBox(instanceOfDatabase.GetCellCoords()) } class cExcel { static GetCellCoords() { r...
by wpb
02 Mar 2024, 04:53
Forum: Ask for Help (v2)
Topic: Static methods in base class not accesssible in derived class via "this".
Replies: 11
Views: 384

Re: Static methods in base class not accesssible in derived class via "this".

Because databaseObjectInstance might be some other type of object that isn't derived from cExcel. But it should still have a GetCellCoords() method. Does that make sense? Perhaps I could define a __Call() method in the derived class that checks super for the relevant method? Not sure if that would w...
by wpb
02 Mar 2024, 03:57
Forum: Ask for Help (v2)
Topic: Static methods in base class not accesssible in derived class via "this".
Replies: 11
Views: 384

Re: Static methods in base class not accesssible in derived class via "this".

Thanks. The issue is this: I have a cExcel class, which provides various helper functions for dealing with Excel. It's in my lib, and I use it from various scripts I've written, and all its methods are static, so I don't have to create a cExcel object, I just use, eg. cExcel.GetActiveWorkbook(). Now...
by wpb
01 Mar 2024, 19:41
Forum: Ask for Help (v2)
Topic: Static methods in base class not accesssible in derived class via "this".
Replies: 11
Views: 384

Re: Static methods in base class not accesssible in derived class via "this".

Thanks, @teadrinker. That's interesting, but doens't help in situations like this:

Code: Select all


x := Child()
x.someMethod()


class Base
{
	static someMethod()
	{
		MsgBox("Hello")
	}
}

class Child extends Base
{
	__New()
	{
		MsgBox("Hello from child.")
	}
}

Go to advanced search