[jawsscripts] Re: a quick window destroyed event query

  • From: Doug Lee <doug.lee@xxxxxxxxxxxxxxxx>
  • To: jawsscripts@xxxxxxxxxxxxx
  • Date: Wed, 22 Feb 2017 13:34:29 -0500

I think I usually don't do it in the WindowCreatedEvent. Do it when you first 
recognize the window as something worth working with. If a window is created 
that never reaches that point, because it's the wrong window or because
it's destroyed before you can get to it, nothing lost this way.

On Wed, Feb 22, 2017 at 06:31:36PM +0000, Sean Farrow wrote:
Hi Doug,

Thanks, would you always do the caching in WindowCreatedEvent, or could you 
feasibly do itin any other event?
Cheers
Sean.

-----Original Message-----
From: jawsscripts-bounce@xxxxxxxxxxxxx 
[mailto:jawsscripts-bounce@xxxxxxxxxxxxx] On Behalf Of Doug Lee
Sent: Wednesday, February 22, 2017 18:22
To: jawsscripts@xxxxxxxxxxxxx
Subject: [jawsscripts] Re: a quick window destroyed event query

Using the WindowDestroyedEvent is tricky because all the information about the 
window can be gone by the time the event fires. I rarely use that event for 
this reason; and when I do, I also usually cache window handles from elsewhere 
so I can recognize when the window that's going away is one I was watching for. 
An overly simple example:

globals collection gMyWindows
void function WindowCreatedEvent(handle hwnd, ...) if getWindowClass(hwnd) == 
"blah"
        if !gMyWindows
                gMyWindows = new collection
        endIf
        gMyWindows[intToString(hwnd)] = 1
endIf
windowCreatedEvent(hwnd, ...)
endFunction

void function WindowDestroyedEvent(handle hwnd) if gMyWindows[intToString(hwnd)]
        collectionRemoveItem(gMyWindows, intToString(hwnd))
        sayString("There goes one!")
endIf
windowDestroyedEvent(hwnd)
endFunction

On Wed, Feb 22, 2017 at 06:13:20PM +0000, Sean Farrow wrote:
Hi,
I'm having to use WindowDestroyedEvent to perform some logic, but am getting an 
invalid window hasndle when I try and get the class. Does anyone know whythis 
is happening and whether there are any work arounds?
Cheers
Sean.

__________???

View the list's information and change your settings at 
//www.freelists.org/list/jawsscripts

--
Doug Lee, Senior Accessibility Programmer SSB BART Group - 
Accessibility-on-Demand mailto:Doug.Lee@xxxxxxxxxxxxxxxx  ;
http://www.ssbbartgroup.com "While they were saying among themselves it cannot ;
be done, it was done." --Helen Keller __________???

View the list's information and change your settings at 
//www.freelists.org/list/jawsscripts

__________???

View the list's information and change your settings at 
//www.freelists.org/list/jawsscripts

-- 
Doug Lee, Senior Accessibility Programmer
SSB BART Group - Accessibility-on-Demand
mailto:Doug.Lee@xxxxxxxxxxxxxxxx  http://www.ssbbartgroup.com
"While they were saying among themselves it cannot be done,
it was done." --Helen Keller
__________�

View the list's information and change your settings at 
//www.freelists.org/list/jawsscripts

Other related posts: