[jawsscripts] Re: Changing and Saving / Restoring Cursors

  • From: "Donald Marang" <donald.marang@xxxxxxxxx>
  • To: <jawsscripts@xxxxxxxxxxxxx>
  • Date: Thu, 4 Dec 2008 10:10:20 -0500

I guess that I should have stated that I have been using JAWS 10 since I got 
this urge for this project in October.  The FocusChngedEvent was very 
confusing.  I didn't take a lot of time deciphering the function, but I 
couldn't figured how it called all these events.  Perhaps the calls that 
start with "Process..." have this effect?

I did notice that at the end of the default ActiveItemChangedEvent had the 
following comment:
"; removed code from this spot for special handling of list view items
; in favor of the internal handling using SayObjectActiveItem()"

I don't know what this means and I don't know if this matters?

Perhaps I should peruse the version 9 default file to see if there any 
changes?  Perhaps I should see how my scripts would work in version 9?

Don Marang


----- Original Message ----- 
From: "Doug Lee" <doug.lee@xxxxxxxxxxxxxxxx>
To: <jawsscripts@xxxxxxxxxxxxx>
Sent: Thursday, December 04, 2008 8:28 AM
Subject: [jawsscripts] Re: Changing and Saving / Restoring Cursors


> Look at FocusChangedEventEx in default.jss.  It's sort of the
> grand-daddy of all focus change events, and it's what calls
> FocusChangedEvent, ActiveItemChangedEvent, etc.
>
> ActiveItemChangedEvent is specifically designed to handle focus
> changes within one control.  That's why it's not called when you first
> Tab into a list.
>
> The arguments of -4 are indeed an MSAA thing:  That's ObjID_Client, an
> indicator of which part of the window was responsible for the event.
>
> On Thu, Dec 04, 2008 at 08:13:44AM -0500, Donald Marang wrote:
> I did review some of the JAWS customizing features more after I read your
> first message.  I played around with the Custom Highlight a little some to
> understand it better.  Thanks for sharing your "inside tricks" in the JCL
> file.  I am shocked that this feature alone could fix iTunes so much!
>
> Yes my main issue with this chunk of code is the fact that I continually
> need to press the PCCursor key after changing items to have JAWS recognize
> this as a list and generate the next ActiveItemChangedEvent.  I have also
> had similar problems when first moving to the list. I first tried to use 
> the
> various statements to directly set the current focus / selection to the
> first item in the list from the main window.  But that alone did not do 
> what
> I wanted.  I am unclear what the differences are between the various
> functions are to move /set focus functions for windows and lists.  I was
> also surprised that the ActiveItemChangedEvent does not get triggered when
> first moving to the list.  Especially when the current and previous window
> handles are passed as parameters.By the way, what does it mean for the
> second and fourth, "ID" parameters to have value of -4?  What are these
> "IDs"?  Is this a MSAA thing?  Sorry if my parameter names are not
> descriptive.  I was/ am not clear of their use when I created the 
> function.
>
> I have been placing simple SayString statements all, sometimes saying
> variable values to try to determine where the problems are hiding.
> Fortunately, I was a Computer Architect many years ago and am reasonably
> experienced with other programming languages and debugging.  I think my 
> next
> step will be to insert some strategically placed statements that report 
> the
> state of the cursor with the IsPCCursor function.
>
> Don Marang
>
>
> ----- Original Message ----- 
> From: "Geoff Chapman" <gch@xxxxxxxxxxxxxxxx>
> To: <jawsscripts@xxxxxxxxxxxxx>
> Sent: Thursday, December 04, 2008 5:58 AM
> Subject: [jawsscripts] Re: Changing and Saving / Restoring Cursors
>
>
>> Hi Don.
>>
>> well, I myself have never used either the activeItemChangedEvent or the
>> windowCreatedEvent, so unfortunately can't give actual specifics about
>> your
>> sitch.
>>
>> couple things that occur to me to comment upon though,
>> were,  that I wasn't quite
>> clear after reading that message, which certainly explained
>> comprehensively
>> about the application itself and some of the details of why you wanna 
>> use
>> it,
>> exactly what was the major problem you were striking with this current
>> code?
>>
>> other than you said you keep having to turn on PC cursor again after
>> hitting
>> down arrow?
>> Again, very novice and probably useless things to point out, and my
>> ability
>> to follow logic carefully through each component of a script is at 
>> present
>> minimal,
>> but, I was wondering,
>> have you put in multiple sayStrings all over the place, within and 
>> outside
>> these if and elif conditions, to debug/confirm exactly what bits of the
>> code
>> are actually getting run, and what are not, in the various situations?
>> This is how I've found it helpful to debug stuff, after advice from 
>> people
>> up here.
>> like if the jaws cursor seems to you to be remaining active when you 
>> don't
>> feel it should be, working out where to maybe place another PcCursor
>> command, might be arrived at through the usage of SayStrings to debug?
>>
>> now, as for CustomHighlight assign, it can only really help if you know
>> the
>> items you wanna read, actually do change color/become focused or
>> highlighted
>> in some way,
>> as you arrow through them with pcCursor, which of course they may not, if
>> they're simply readable stuff for the sightlings.
>> And, if you think the highlight color isn't a standard windowsy one.
>>
>> one thing to also remember is, that even if they do change color to a
>> custom
>> highlight color  as you move through them, they might well change to a
>> totally different color, when the jawsCursor/mouse hovers over them.
>> Thus,
>> using the invisible  Cursor, to check their colors,
>> rather than the jawsCursor, is in my view, the recommended option there.
>> Use of course insert+Top Row number 5 to check textColors of stuff.
>> if after doing that, you are convinced there is a concept of items in 
>> this
>> list view actually becoming highlighted, and also changing their color to
>> reflect this, then you can put the invisible cursor on that item and
>> choose
>> the custom highlight assign command, insert+control+h.
>>
>> it should ask you foreground and background, to which you'd answer yes.
>> and then it should show the new color in a dialog etc, with an radio
>> button
>> option to have both windows standard and custom colors read, which is 
>> what
>> you want, so just leave that and hit enter.
>> This color will then get added in the app.jcf file, under a new section
>> it'll put in there probably called something like [CustomHighlights]
>> or some such thing.
>> it'll have an =1, at the end of it, but for experimentation purposes, to
>> in
>> effect disable it but not remove it, which is all that the front end
>> customhighlight box permits, you can change this 1 to a 0 and resave the
>> jcf
>> file. then flip it back to 1 again as needs be, if you wanna just quickly
>> check stuff is working or whatever, without having to rego through
>> deleting
>> and reassigning the whole custom highlight color etc.
>>
>> i used this very effectively in ITunes before they introduced MSAA into
>> it,
>> and it brought the whole thing to life. menu bars too. no scripting
>> needed!
>>
>>
>> ----- Original Message ----- 
>> From: "Donald Marang" <donald.marang@xxxxxxxxx>
>> To: <jawsscripts@xxxxxxxxxxxxx>
>> Sent: Thursday, December 04, 2008 7:07 PM
>> Subject: [jawsscripts] Re: Changing and Saving / Restoring Cursors
>>
>>
>>> Actually, I am certainly a novice at scripting.I had written minor
>>> scripts
>>> for many years, but nothing like this.  It is a great learning
>>> experience!
>>> I have never used many features in JAWS, like Custom Highlight Assign.
>>> As
>>> far as I could tell, it did not seem to handle this situation.
>>>
>>> The unruly application is Verizon Call Assistant.  It is a totally free
>>> software and web service for Verizon customers who still have a home,
>>> land
>>> line phone.  It is most usefull if you have Caller ID and Voice Mail on
>> that
>>> line.  This is exciting to me since I have all of these!  I realize that
>>> most people have moved on and replaced these relics with newer more
>> flexible
>>> technology, like VoIP!  Once you create an account at
>>> verizon.com/callassistant and you link it to your phone number and voice
>>> mail service, you get many new capabilities.  You can view your call 
>>> log,
>>> listen and save voice mails, receive emails for selecctive calls and
>> email,
>>> and maintain a contact list.  If you download the PC software, you can
>> have
>>> all this available all the time and get apop up, "Toast" notification
>>> with
>>> the Caller ID info for calls and voice mails!  It pops up down near the
>>> clock area like a large HelpBalloon.  It even beats the phonne ringing 
>>> by
>> at
>>> least a second.  I also like to know if someone is trying to call and
>>> left
>> a
>>> voice mail while my son is on the phone with his girlfriend.  I can see
>> who
>>> is trying to get through and even listen to the voice mail.  Verizon
>>> promises to bring many new features in the near future including 
>>> advanced
>>> selective forwarding.
>>>
>>> The results show up in a nonstandard dialog below the small main window
>> with
>>> three buttons and a search edit box.  The results dialog is primarily a
>>> nonstandard list view, surounded by a title and controls to go to the
>>> next
>>> and previous pages.  The list shows up to 10 items at a time.  All of 
>>> the
>>> options and settings are managed omn the wevsite.  The only set up on 
>>> the
>> PC
>>> is the login, which can be set to be done automatically when the 
>>> computer
>>> starts up.
>>>
>>> The list only has two columns, even though most of the time there is at
>>> least three things associated with that item that are inportant!  The
>> phone
>>> of the incoming call is not shown in the call log.  To get this
>> information,
>>> you must hover the mouse over the item.  A two line "ToolTip" appears
>>> with
>>> name and number.  New calls are shown in bold.  I also currently say
>>> "item
>>
>>> x" before each item to let me know the ActiveItemChangedEvent occoured.
>>> When the "ToolTip appears, I say the phone number and capture these 
>>> items
>> in
>>> global variables for later use.  Below is my ActiveItemChanged function
>> and
>>> part of my WindowActivatedEventt.
>>>
>>> My WindowActivatedEvent function first checks if the window class =
>> "#32770"
>>> (used by the results dialog, the "HelpBalloon" Toast dialogs and 
>>> various)
>>> "ToolTip" windows).  Then I check the Control ID of the first child to
>>> identify which action should be taken.  The Control ID of this window is
>>> 282.
>>>
>>>
>>> Void Function ActiveItemChangedEvent (handle hWnd, int iCurrentID, Int
>>> iCurrentChild, handle hWndPrevious, Int iPreviousID, Int iPreviousChild)
>>>
>>> If hWnd == ghWndListView Then
>>>  SayString ("Item " + IntToString (iCurrentChild))
>>>  If GetCharacterAttributes () & ATTRIB_BOLD Then SayString ("new ") 
>>> EndIf
>>>  ; SayString ("Selection state = " + IntToString (lvGetItemState (hWnd,
>>> iCurrentChild) ))
>>>
>>>  JAWSCursor ()
>>>  RouteJAWSToPc ()
>>>  LeftMouseButton ()
>>>  PCCursor ()
>>> Else
>>>  SayString ("Call to item changed and not in list view!  Item = " +
>>> IntToString (iCurrentChild))
>>> EndIf
>>>
>>> ActiveItemChangedEvent (hWnd, iCurrentID, iCurrentChild, hWndPrevious,
>>> iPreviousID, iPreviousChild)
>>>
>>> EndFunction
>>>
>>>
>>> Void Function WindowActivatedEvent (handle hWnd)
>>> Var
>>>  Handle hWndFirstChild,
>>>  Int iFirstID,
>>>  Handle hWndLastChild,
>>>  Int iLastID,
>>>  String sTip
>>>
>>> Let hWndFirstChild = GetFirstChild (hWnd)
>>> Let iFirstID = GetControlID (hWndFirstChild)
>>>
>>> Let hWndLastChild = GetLastWindow (hWndFirstChild)
>>> Let iLastID = GetControlID (hWndLastChild)
>>> If GetWindowClass (hWnd) == WND_POPUP_CLASS Then
>>>     If ...; handle other windows
>>>  ELIf iFirstID == WCID_LIST_NAME Then
>>>   ; SayString ("Name and phone pop up")
>>>   Let gsListName = GetWindowName (hWndFirstChild)
>>>   ; SayString ("Caller was: " + gsListName)
>>>
>>>   If IsWindowVisible (hWndLastChild) Then
>>>    Let gsListNumber = GetWindowName (hWndLastChild)
>>>    SayString ("number: " + gsListNumber)
>>>   Else
>>>    ;The ToolTip in the Search rersulrts list view only displays the name
>>>    Let gsListNumber = Null ()
>>>   EndIf
>>>  ElIf iFirstID == WCID_VIEW_CONTACT_NAME Then
>>> ... process other dialogs
>>>  EndIf
>>>
>>> EndIf
>>>
>>> WindowActivatedEvent (hWnd)
>>>
>>> EndFunction
>>>
>>>
>>> Don Marang
>>>
>>>
>>> ----- Original Message ----- 
>>> From: "Geoff Chapman" <gch@xxxxxxxxxxxxxxxx>
>>> To: <jawsscripts@xxxxxxxxxxxxx>
>>> Sent: Wednesday, December 03, 2008 9:44 AM
>>> Subject: [jawsscripts] Re: Changing and Saving / Restoring Cursors
>>>
>>>
>>> > p.s.
>>> > like wen you say, switching whole scripts through
>> activeItemChangedEvent,
>>> > that sounds to me like
>>> > a pretty sledge hammer approach to be trying as a solution?
>>> > again, from a total novice perspective?
>>> > You presumably know all about custom highlight colors and things of
>>> > that
>>> > nature too, right? the simple stuff?
>>> >
>>> >
>>> > ----- Original Message ----- 
>>> > From: "Donald Marang" <donald.marang@xxxxxxxxx>
>>> > To: <jawsscripts@xxxxxxxxxxxxx>
>>> > Sent: Wednesday, December 03, 2008 3:03 PM
>>> > Subject: [jawsscripts] Re: Changing and Saving / Restoring Cursors
>>> >
>>> >
>>> >> Thanks, this seemed to help some.  It has not fixed all my problems,
>> vut
>>> > it
>>> >> is vetter.  I will save this for future reference as well.  It is a
>>> >> little
>>> >> hard to debug with so many events.Today I tried to remove the need 
>>> >> for
>>> >> frames and switch scripts that get called from my own
>>> >> WindowActivatedEvent
>>> >> function.  If I get this working properly, I want to put part of this
>>> > script
>>> >> in a similar function in the default script file, so I will get
>> notified
>>> > by
>>> >> itscustom "HelpBaloon".
>>> >>
>>> >> Right now, I have to press the KeyPad + to force the PCCursor back on
>>> > after
>>> >> each time I use the down arrow in a custom list view I am trying to
>> tame.
>>> >> If I don't, it seems to have the JAWSCursor active, and does not get
>>> > events
>>> >> from ActiveItemChangedEvent.  There must be something funky I am 
>>> >> doing
>>> >> within my ActiveItemChanggedEvent.  I had no idea that my application
>>> >> woulduse MSAA at all, buut I followed a previous suggestion on this
>> list
>>> > and
>>> >> it worked!  I have not investigated how to use MSAA any further at
>>> >> this
>>> >> point.
>>> >>
>>> >> Bless the list for its help.
>>> >>
>>> >> Don Marang
>>> >>
>>> >>
>>> >> ----- Original Message ----- 
>>> >> From: "James Panes" <jimpanes@xxxxxxxxx>
>>> >> To: <jawsscripts@xxxxxxxxxxxxx>
>>> >> Sent: Tuesday, December 02, 2008 5:59 PM
>>> >> Subject: [jawsscripts] Re: Changing and Saving / Restoring Cursors
>>> >>
>>> >>
>>> >> > Yes, the cursors do save on a stack. Another very important thing 
>>> >> > to
>>> >> > remember is that JAWS does not save the position of the PC Cursor
>> when
>>> > it
>>> >> > is
>>> >> > saved. There are valid scripting reasons why this is the case.
>>> >> >
>>> >> > To save and restore the PC cursor, I do the following:
>>> >> > InvisibleCursor ()
>>> >> > SaveCursor ()    ; This saves the original position of the 
>>> >> > invisible
>>> >> > cursor
>>> >> > Move InvisibleToPC ()
>>> >> > SaveCursor ()    ; This uses the invisible cursor to save the
>> position
>>> > of
>>> >> > the PC cursor.
>>> >> >
>>> >> > Code that changes positions here
>>> >> >
>>> >> > RestoreCursor ()    ; This moves the invisible cursor to the
>>> >> > original
>>> >> > position of the PC Cursor.
>>> >> > RoutePCToInvisible () ; Places PC cursor back at its original
>> position.
>>> >> > RestoreCursor ()    ; Places Invisible cursor back to its original
>>> >> > position.
>>> >> > PCCursor ()    ; Activates PC cursor.
>>> >> >
>>> >> > This places the PC cursor and the invisible cursor back to where
>>> >> > they
>>> > were
>>> >> > and activates the PC cursor. The other thing is to make sure that
>>> >> > the
>>> >> > PC
>>> >> > cursor is active before going to all this trouble.
>>> >> >
>>> >> > Some scripters do not bother to save and restore the invisible
>> cursor.
>>> >> >
>>> >> > Regards,
>>> >> > James
>>> >> > jimpanes@xxxxxxxxx
>>> >> > jimpanes@xxxxxxxxxxxx
>>> >> > "Everything is easy when you know how."
>>> >> >
>>> >> > ----- Original Message ----- 
>>> >> > From: "Doug Lee" <doug.lee@xxxxxxxxxxxxxxxx>
>>> >> > To: <jawsscripts@xxxxxxxxxxxxx>
>>> >> > Sent: Tuesday, December 02, 2008 4:39 PM
>>> >> > Subject: [jawsscripts] Re: Changing and Saving / Restoring Cursors
>>> >> >
>>> >> >
>>> >> > My standard idiom is saveCursor() invisibleCursor() saveCursor():
>> The
>>> >> > first saveCursor keeps track of which cursor was active to begin
>> with,
>>> >> > and the second saves the position of the invisible cursor before I
>>> >> > move it.
>>> >> >
>>> >> > On Tue, Dec 02, 2008 at 04:32:27PM -0500, Donald Marang wrote:
>>> >> > In the examples I have seen for using the SaveCursor and
>> RestoreCursor
>>> >> > functions, they use the following order:
>>> >> > InvisibleCursor ()
>>> >> > SaveCursor ()
>>> >> > perform statements that move the focus...
>>> >> > RestoreCursor ()
>>> >> >
>>> >> > If the save and restore functions work like a stack, wouldn't the
>>> >> > SaveCursor
>>> >> > function need to be called first, and then change cursors?  I am a
>>> > little
>>> >> > confused here.  I am finding my application being continually with
>> the
>>> >> > InvisibleCursor active, and I am not sure why!
>>> >> >
>>> >> > Don Marang
>>> >> >
>>> >> >
>>> >> > __________?
>>> >> > Visit and contribute to The JAWS Script Repository
>>> > http://jawsscripts.com
>>> >> >
>>> >> > View the list's information and change your settings at
>>> >> > http://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
>>> >> > __________
>>> >> > Visit and contribute to The JAWS Script Repository
>>> > http://jawsscripts.com
>>> >> >
>>> >> > View the list's information and change your settings at
>>> >> > http://www.freelists.org/list/jawsscripts
>>> >> >
>>> >> > __________
>>> >> > Visit and contribute to The JAWS Script Repository
>>> > http://jawsscripts.com
>>> >> >
>>> >> > View the list's information and change your settings at
>>> >> > http://www.freelists.org/list/jawsscripts
>>> >> >
>>> >>
>>> >> __________
>>> >> Visit and contribute to The JAWS Script Repository
>> http://jawsscripts.com
>>> >>
>>> >> View the list's information and change your settings at
>>> >> http://www.freelists.org/list/jawsscripts
>>> >>
>>> >
>>> > __________
>>> > Visit and contribute to The JAWS Script Repository
>> http://jawsscripts.com
>>> >
>>> > View the list's information and change your settings at
>>> > http://www.freelists.org/list/jawsscripts
>>> >
>>>
>>> __________
>>> Visit and contribute to The JAWS Script Repository 
>>> http://jawsscripts.com
>>>
>>> View the list's information and change your settings at
>>> http://www.freelists.org/list/jawsscripts
>>>
>>
>> __________
>> Visit and contribute to The JAWS Script Repository http://jawsscripts.com
>>
>> View the list's information and change your settings at
>> http://www.freelists.org/list/jawsscripts
>>
>
> __________?
> Visit and contribute to The JAWS Script Repository http://jawsscripts.com
>
> View the list's information and change your settings at
> http://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
> __________
> Visit and contribute to The JAWS Script Repository http://jawsscripts.com
>
> View the list's information and change your settings at
> http://www.freelists.org/list/jawsscripts
> 

__________ 
Visit and contribute to The JAWS Script Repository http://jawsscripts.com

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

Other related posts: