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

Reply via email to