Charles Steyn wrote:
Thanks very much for your comments. I'll experiment further. I'll have
to get the handling of the OnChildFocus and OnChildBlur events right
before my script really would work correctly.
It'd go something like this:
Dim theEditorWindow : Set theEditorWindow = <a window object
representing the editor window>
ConnectEvent theEditorWindow, "OnChildFocus", "RegisterMyKeys"
ConnectEvent theEditorWindow, "OnChildBlur", "UnregisterMyKeys"
Sub RegisterMyKeys(windowObj)
' Register your keys here
End Sub
Sub UnregisterMyKeys(windowObj)
' Unregister your keys here
End Sub
How you find the editor window is up to you. In Studio 2008, the module
name is MSENV, and the class name is VsTextEditPane. You could use the
Window object's FilterByClassAndModule to search for that window, and if
you find it, then hook your events (in that case, you'd use OnFocus and
OnBlur rather than the child events because you are only interested in
that one window). Alternatively, you could hook the main application
window when the script starts, and then look for the right class name in
your register/unregister subs. That would go a little something like this:
ConnectEvent ClientInformation.Overlap, "OnChildFocus", "RegisterMyKeys"
ConnectEvent ClientInformation.Overlap, "OnChildBlur", "UnregisterMyKeys"
Sub RegisterMyKeys(windowObj)
If windowObj.ClassName = "VsTextEditPane" Then
' Register your keys here
End If
End Sub
Sub UnregisterMyKeys(windowObj)
If windowObj.ClassName = "VsTextEditPane" Then
' Unregister your keys here
End If
End Sub
The second method is a bit more work, but it's another example of how to
skin this cat.
Aaron
--
To insure that you receive proper support, please include all past
correspondence (where applicable), and any relevant information
pertinent to your situation when submitting a problem report to the GW
Micro Technical Support Team.
Aaron Smith
GW Micro
Phone: 260/489-3671
Fax: 260/489-2608
WWW: http://www.gwmicro.com
FTP: ftp://ftp.gwmicro.com
Technical Support & Web Development