[jawsscripts] Re: Focus To Control ID

  • From: "Mike" <mike_sharp@xxxxxxxxxxxxx>
  • To: <jawsscripts@xxxxxxxxxxxxx>
  • Date: Wed, 14 Jul 2010 14:17:55 +0100

Hi Jackie,

Thanks for this suggestion. Interestingly I have found that I am able to set 
focus directly to the control ID using:
SetFocus (FindDescendantWindow(GetAppMainWindow(GetCurrentWindow()), 
ControlID))
Replacing ControlID with the ID of the field.

Regards,

Mike

--------------------------------------------------
From: "Jackie McBride" <abletec@xxxxxxxxx>
Sent: Friday, July 09, 2010 2:26 PM
To: <jawsscripts@xxxxxxxxxxxxx>
Subject: [jawsscripts] Re: Focus To Control ID

> Let's try this, Mike.
>
> var
>   handle hw
>
> let hw = FindDescendantWindow(GetAppMainWindow(GetCurrentWindow()), 
> ControlID)
> if (hw) then
>   SetFocus(hw)
> else
>  sayMessage(OT_NO_DISABLE, "window not found")
> endif
>
> U may have to do some experimenting regarding finding the particular
> window. Also, make certain the program actually does allow this window
> to in fact be focused, else the function won't work, &, because it
> returns void, the only way you'll know that is to not have it do what
> it's supposed to do. Fine for u, not so fine if it's a user for whom
> you're scripting lol.
>
> U can also use the FindWindowWithClassAndID() function, which takes
> both a window class & a control ID. Experiment w/those & see if either
> works for u.
>
> HTH.
>
> HTH.
>
> On 7/9/10, Steve Matzura <number6@xxxxxxxxxxxxx> wrote:
>> Since you can only set focus to a window by its handle, the only thing
>> I can think of to re-create your function is to write a tree-walker,
>> which does what HRM does, but in an automated fashion--namely, the
>> F2/Shift+F2 functionality and the TAB/Shift+TAB functionality to
>> inspect each and every window of the application to find its control
>> ID and match it against the one you want.  When you find it, save its
>> handle in a handle variable, then you can do whatever you need to
>> because you know how to get there and set focus to it or do whatever.
>> Funny thing about this is, I took two weeks of scripting class at FS
>> two years ago, and this is the one thing I never got to figure out how
>> to do.
>>
>> On Fri, 9 Jul 2010 06:36:25 +0100, you wrote:
>>
>>>Hi All,
>>>
>>>I used to have a function that would set the focus to a specified control
>>> ID
>>>but somehow it has disappeared. Does anyone have a suggestion for this?
>>>
>>>Regards,
>>>
>>>Mike
>>>
>>>__________�
>> __________�
>>
>> View the list's information and change your settings at
>> http://www.freelists.org/list/jawsscripts
>>
>>
>
>
> -- 
> Change the world--1 deed at a time
> Jackie McBride
> Scripting Classes: http://jawsscripting.lonsdalemedia.org
> homePage: www.abletec.serverheaven.net
> For technophobes: www.technophoeb.com
> __________�
>
> View the list's information and change your settings at
> http://www.freelists.org/list/jawsscripts
>
> 
__________�

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

Other related posts: