Thanks Jeff, now that really is interesting.
 
When I ran it here once or twice on my xp machine it ran ok.
 
Do you have the "make mouse pointer follow focus" script running?
 
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: Jeff Weiss [mailto:[email protected]] 
        Sent: Tuesday, June 30, 2009 3:12 PM
        To: [email protected]
        Subject: RE: example for vista control not focusing problem
        
        
        Chip,
        I may not have done this just right, but I tested this code on
my xp pro sp3 machine.
        I used hotkeys to open three windows explorer windows.
        I got the messages "setting focus to some other window"
        Then I got the message "failed to set focus to listview control.
        This was with my xp machine and we 7.1.
        I know you meant this to be tested  on vista machine, but it
seems to have failed here also.
        Jeff Weiss
         
            
        
________________________________

        From: Chip Orange [mailto:[email protected]] 
        Sent: Tuesday, June 30, 2009 11:43 AM
        To: [email protected]
        Subject: example for vista control not focusing problem
        
        
        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.)
        

         

Reply via email to