[jawsscripts] double speaking of controls

  • From: "David Farough" <David.Farough@xxxxxxxxxxxxx>
  • To: <jawsscripts@xxxxxxxxxxxxx>
  • Date: Fri, 09 Jul 2010 12:21:31 -0400

This can happen if some event causes a function to occur more than once
when the focus changes.

I fixed this once in an app that I was scripting by modifying the
SayObjectTypeAndText function for that application.  You will need to
determine just which function is actually being used to speak the
control.  I would start by creating a function by that name and
including a saystring or some other statement to speak something so that
you know if this is the function that needs to be changed. If this is
the right function, you will probably hear Jaws speak your string once
or more times each time you press the tab key.  If this is the case and
you do hear this double speaking of your string, then you will know what
function to modify.

Next you will need to declare a global variable to contain the name or
whatever information is being spoken when the control gains focus.

I will include below the function that I wrote which I hope will give
you some idea on how to proceed.

The Global variable I declared was called gsFieldName and it was a
string variable.
the following statement will do this.
globals string gsFieldName

The problem I was addressing in this situation was the fact that Jaws
was speaking the name of the field each time I typed any character  into
the edit field. therefore I wanted Jaws to speak only when the name of
the field changed.  You will see that in the SayobjectTypeAndText
function I checked to see which Dialogue or real window names were being
used and I only called the speakeditFields function for those dialogues.
 If these dialogues were not being used, I called the default version of
SayobjectTypeAndText function. This way I make sure that I continue to
get the benefits of the default Jaws functionality when appropriate.

Void Function SayObjectTypeAndText (int id)
var string sName, string sClass, handle hwnd
let sName = GetWindowName (GetRealWindow (GetFocus ()))
let sClass = GetWindowClass (GetFocus ())
if (StringContains (sName, "Search -  Formulaire de recherche")
        || StringContains (sName, "Electronic - Électronique")
        ) then 
        if (StringContains (sName, "Electronic - Électronique" ) && 
                StringContains (sClass, "EDIT")) then 
                        ScheduleFunction ("SpeakEditFields", 1)
                        RETURN ; get out so that default function is not
performed.
        endif

endif
SayObjectTypeAndText (id)


EndFunction

Now here is the SpeakEditFields function.
The looping through window names is specific to my application and
would not normally be necessary.  However it will provide an idea of
what can be done to obtain the name of a window.  Notice that I used the
StringContains function to determine if the window name  was the same. 
The StringContains function will return a positive number if the string
is found and will return false or zero if the string is not found.  So
in this case I want nothing to happen if the string is found and if the
string is different, I want the name of the field to be spoken and I
want the value of the global variable to be set to the value for the new
name.
I hope I have explained this well enough to give you some ideas for
your scripts.
Void Function SpeakEditFields ()
var string sLabel, handle hwnd, string sName
let hwnd = GetParent (GetFocus ())
let hwnd = GetFirstWindow (hwnd)
while (StringLength (sName)<1)
        let sName = GetWindowName (hwnd)
        let hwnd = GetNextWindow (hwnd)
endwhile
if (StringContains (gsFieldName, sName)) then ; do nothing 
else
        let gsFieldName = sName
        IndicateControlType (wt_edit, sName, GetWindowText (GetFocus (),
false))

endif

EndFunction


David Farough
Application Accessibility Coordinator/coordonateur de l'accessibilité 
Information Technology Services Directorate /
Direction des services d'information technologiques
Public Service Commission / Commission de la fonction publique
Email / Courriel:  David.Farough@xxxxxxxxxxxxx
Tel. / Tél:    (613) 992-2779 >>> Steve Matzura <number6@xxxxxxxxxxxxx>
01:12 AM Friday, July 09, 2010 >>>

Last lickable problem: Why do all the tutor messages and controls that
have them speak twice when I tab through the pane?



This e-mail message is intended for the named recipient(s) and 
may contain information that is privileged, confidential and/or 
exempt from disclosure under applicable law. Unauthorized 
disclosure, copying or re-transmission is prohibited. If you are not 
a named recipient or not authorized by the named recipient(s), or 
if you have received this e-mail in error, then please notify the 
sender immediately and delete the message and any copies.
 
Ce courriel est destine exclusivement au destinataire mentionne 
en titre et peut contenir de l'information privilegiee, confidentielle 
ou soustraite a la communication aux termes des lois 
applicables. Toute divulgation non autorisee, toute reproduction 
ou reacheminement est interdit. Si vous n'etes pas le 
destinataire de ce courriel, ou n'etes pas autorise par le 
destinataire vise, ou encore, si vous l'avez recu par erreur, 
veuillez le mentionner immediatement a l'expediteur et supprimer 
le courriel et les copies. 
__________�

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

Other related posts: