' Draft of Scripting class 22 (7/31/2011)
' today's class is the start of making problem programs accessible.
' example 1:
' example showing how we determine what's wrong, and come up with a
correction for, the Windows Display Settings control for screen resolution
not speaking in xp, vista, and win7.
' (thanks to GW for pointing out this problem, although their solution is
slightly different from this one, they also get a thanks for the solution
idea)
' (most of this is in the verbal presentation, here is only the final
solution)
dim c1,c2,c3
' watch for the Display Settings window to be activated
c3 = ConnectEvent(desktopWindow, "onChildActivate", "onChildActivate")
Sub onChildActivate(w)
if w.title = "Display Settings" then
' This is the Display Settings window being activated.
' when you tab to a control, window-eyes speaks a prompt for the control
called it's "field name", and the value of what's in the control called the
"field data".
' (there are two hotkeys of control-shift-n, and control-shift-d, which
speak these)
' the solution here is to hook the onChildFieldName and onChildFieldData
events for the Display Settings window,
' so we can say appropriate values for the control (when it gets focus) for
the resolution control which is a trackbar.
' we don't use the onFocus event, although it might work, because we also
need to stop WE from saying what it currently does say for this trackbar,
' as well as speaking the correct values. this is easier to do by giving
the correct values in the field name and data events.
' (it also allows the hotkeys mentioned to function properly)
c1=connectEvent(w, "onChildFieldName", "onFN")
c2=connectEvent(w, "onChildFieldData", "onFD")
' the two event handlers will have to determine when they are being called
for the trackbar control in question.
end if
end sub
function onFN(win)
' event handler for onChildFieldName
onFN=vbNull ' returning this causes WE to speak whatever it would have
if win.name = "msctls_trackbar32" then
' this is the correct trackbar control
onFN=win.parent.control(1854).text ' return the static control
correct for Vista/Win7
end if
end function
function onFD(win)
' event handler for onChildFieldData
onFD=vbNull ' causes WE to speak it's default value for this control
if win.name = "msctls_trackbar32" then
' this is the correct trackbar control
onFD=win.parent.control(1814).text ' return the correct static
control for vista/win7
end if
end function
' archives of these classes can be found at:
' https://www.gwmicro.com/App_Central/Developers/Interactive_Classes/