Chip,
Then maybe we are chasing two problems which is causing confusion.
For me the listview always takes focus. But the script is written such
that if the listview already has focus you try and set it to something
else. If instead when Windows Explorer gets activation the listview
doesn't have focus then you set focus to the first listview with a state
of focusable. In Jeff's case he said:
I got the messages "setting focus to some other window"
Then I got the message "failed to set focus to listview control.
This isn't even possible so I think here is the confusion. If the
script says "setting focus to some other window" then it won't say
"failed to set focus to listview." I'm betting the farm Jeff's second
message was actually "failed to set the alternate control as the
focus!" You don't get "setting focus to some other window" unless the
listview already has focus so I would argue that what I wrote is exactly
what happened to Jeff and probably others. So can you give me a case
where the listview itself doesn't take focus and are you absolutely sure
it is the listview you really want? I can't test this at the moment but
you just set focus to the first listview you find that has a state of
focusable. Again, is this the one you really want?
I think we need to leave others out of this mix and you need to give me
exactly what is failing for you. So I'm going to hold off from further
comments until I hear back with your personal observations as us both
trying to comment on what others are getting is starting to get to me
<smile>.
Regards,
Doug
Chip Orange wrote:
Thanks Doug for doing all this work.
However, I think you may have missed the main issue: I am
specifically searching out the list view control, and trying to set
focus to it, and it is failing. It does not matter very much about
what other control I moved off to, I was there only so I could see a
focus change back to the list view control.
This is working for some people, but not others (setting focus to the
list view control I mean).
If you think randomly picking another control is a problem, then you
can comment out that one line of the example, click on some control
other than the list view in a windows explorer window, alt tab away,
and alt tab back. that perhaps would better demonstrate the problem
that some of us are seeing.
thanks.
Chip
------------------------------
Chip Orange
Database Administrator
Florida Public Service Commission
[email protected]
(850) 413-6314
(Any opinions expressed are solely those of the author and do not
necessarily reflect those of the Florida Public Service Commission.)
------------------------------------------------------------------------
*From:* Doug Geoffray [mailto:[email protected]]
*Sent:* Tuesday, June 30, 2009 5:02 PM
*To:* [email protected]
*Subject:* Re: example for vista control not focusing problem
Chip,
After playing a bit more I believe I see the problem. I modified
the script so the setSomethingElseAsFocus script would go through
each child window and try to set focus to each and report whether
it could or couldn't. I displayed the classname and failed or
worked. In my Vista case there are 26 child windows with the
Focusable attribute. So now the script is trying to set it to
each of the 26 and reporting the status. Here are the ones that
worked and here are the ones that didn't.
setting to ShellTabWindowClass - worked
setting to DUIViewWndClassName - worked
setting to TravelBand - worked
setting to Address Band Root - worked
setting to UniversalSearchBand - worked
setting to Search Control - worked
setting to ToolbarWindow32 - worked
setting to SHELLDLL_DefView -worked
setting to CommonPlacesWrapperWndClass - worked
setting to NamespaceTreeControl - worked
setting to WorkerW - failed
setting to ReBarWindow32 - failed
setting to WorkerW - failed
setting to ReBarWindow32 - failed
setting to ToolbarWindow32 - failed
setting to msctls_progress32 - failed
setting to CtrlNotifySink - failed
setting to CtrlNotifySink - failed
setting to CtrlNotifySink - failed
setting to Breadcrumb Parent - failed
setting to ToolbarWindow32 - failed
setting to ToolbarWindow32 - failed
setting to Edit - failed
setting to ToolbarWindow32 - failed
setting to SysTreeView32 - failed
setting to SysHeader32 - failed
This is consistent for me. Meaning the ones that work always do
and the ones that fail always fail. You are sort of randomly just
picking the first control with the focusable attribute and in my
case it was one that worked and in other's it wasn't.
Unfortunately Microsoft is saying a control is focusable even
though it really isn't. Welcome to the world of MSAA.
Window-Eyes is constantly hacking around issues like this. So
this really isn't a Window-Eye bug but more of a Microsoft MSAA
issue with Windows Explorer.
Of course a script isn't going to try and set focus to some random
control, you are going to set it to something you need, not
because it has a focusable attribute so this most likely isn't a
real world problem anyway.
But bottom line, I just don't see anything that says this is a WE
problem.
Regards,
Doug
Chip Orange wrote:
thanks Doug.
you'll see Jeff is also having the problem under xp, while Jim,
like you, is not under vista.
I'll keep looking for the cause, but at the moment, I'm out of
ideas, except to collect data from those who also experience the
issue.
Chip
------------------------------
Chip Orange
Database Administrator
Florida Public Service Commission
[email protected]
(850) 413-6314
(Any opinions expressed are solely those of the author and do
not necessarily reflect those of the Florida Public Service
Commission.)
------------------------------------------------------------------------
*From:* Doug Geoffray [mailto:[email protected]]
*Sent:* Tuesday, June 30, 2009 4:18 PM
*To:* [email protected]
*Subject:* Re: example for vista control not focusing problem
Chip,
I tried this exact script (unchanged) under Vista 32-bit SP 2
and had no problem. When I activated a Windows Explorer
window and the listview had focus I heard:
setting the focus to something else
custom control
setting the focus to the listview control
Visually I saw the listview control lose focus for a bit and
then come back. If I change the focus manually to say the
treeview, alt-tab away from the Windows Explorer window and
alt-tab back then I hear:
setting the focus to the listview control
and in fact the focus is on the listview control.
So I'm just not seeing any problem... You need to test this
yourself on your Vista machine...
Regards,
Doug
Chip Orange wrote:
Hi Doug and Aaron,
I can't test this here where I wrote it, at least I can but
it doesn't fail on xp, but below is an example of a script
which waits for a windows explorer window to be made the
active window, then when it is the script attempts to
demonstrate the problem by setting some other control to be
focused, then setting the list view to have the focus.
thanks.
Chip
---------
option explicit
' watch for newly activated windows (looking for Windows
Explorer)
connectEvent desktopWindow, "onChildActivate",
"onChildActivate"
sub onChildActivate ( window )
if window is nothing then exit sub
if not window.isValid then exit sub
if strComp ( uCase ( window.moduleName), "BROWSEUI") <> 0
then exit sub
if strComp ( uCase ( WINDOW.className), "CABINETWCLASS") <>
0 THEN EXIT SUB
' this is a windows explorer window, find the list view control
' do so with a slight delay to give the window time to
populate, and to clear this handler routine as soon as possible
queue "handleWindowsExplorerWindow", window
end sub
sub HandleWindowsExplorerWindow ( window )
' search the children of this window, looking for the list
of files, which we want to make the focused control when we
return to this type of window
dim oChild
for each oChild in window.Children.filterByType(wtListView)
if not window.isValid then exit sub
if not oChild.isValid then exit sub
If oChild.Accessible.State.Focusable And oChild.Visible And
oChild.Enabled then
' this is the list of files in a windows explorer window
If oChild.Accessible.State.Focused then
setSomethingElseAsFocus ( window )
If not oChild.Accessible.State.Focused then
speak "setting the focus to the list view control" ' temporary
oChild.focus
sleep 1000
If not oChild.Accessible.State.Focused then speak "failed
to set the list view as the focus!"
end if
exit sub
end if
next
end sub
sub setSomethingElseAsFocus ( window )
' make some other control than the listview be the focus
dim oChild
for each oChild in window.Children
if not window.isValid then exit sub
if not oChild.isValid then exit sub
if oChild.type <> wtListView then
' it's not a list view, so see if it can be focused
If oChild.Accessible.State.Focusable And oChild.Visible And
oChild.Enabled then
' this is focusable
If not oChild.Accessible.State.Focused then
speak "setting the focus to something else"
oChild.focus
sleep 1000
If not oChild.Accessible.State.Focused then speak "failed
to set the alternate control as the focus!"
end if
exit sub
end if
end if ' oChild.type <> wtListView
next
end sub
------------------------------
Chip Orange
Database Administrator
Florida Public Service Commission
[email protected]
(850) 413-6314
(Any opinions expressed are solely those of the author and
do not necessarily reflect those of the Florida Public
Service Commission.)
--
Doug Geoffray
GW Micro, Inc.
Voice 260-489-3671
Fax 260-489-2608
http://www.gwmicro.com
--
Doug Geoffray
GW Micro, Inc.
Voice 260-489-3671
Fax 260-489-2608
http://www.gwmicro.com
--
Doug Geoffray
GW Micro, Inc.
Voice 260-489-3671
Fax 260-489-2608
http://www.gwmicro.com