sbc@INFORMATICS.WUSTL.EDU (Steve Cousins) (12/29/90)
I'd like to catch user keys when the cursor is in a read-only text view in an application we're developing. Basically, since the text is read-only anyway, I'd like to send the keys to the search control window, so that the user doesn't have to point the mouse before making a query. Are there hooks in Andrew I can exploit, or is this impossible? Thanks for any advice Steve Cousins sbc@informatics.wustl.edu Medical Informatics Laboratory 314-362-4322 Washington University School of Medicine
tpn+@ANDREW.CMU.EDU (Tom Neuendorffer) (01/02/91)
Steve, Parent views can always override the keymaps of their child views. The easiest way to do this would be to wrap your textview in a celview (this is done automatically if you use ADEW and the arbcon to create your application, but can also be done within the application creating the dataobject and view). The celview has a couple of calls celview_SetKeymap(self,struct celview *celv, struct keymap *km); celview_SetMenulist(self,struct celview *celv, struct menulist *ml); that allow an external object to provide the overriding keymap or menulist. Alternately, if you already have control of the textview's parent, you could take a look at the celview code to see what it does. The view pointer that will be returned when a key is pressed will be to the textview itself, so that if your application has information sitting in this search control window, it will have to be able to map the textview to the right remote window. Then all you need then is a keymap that takes care of all the desired keystrokes.
wjh+@ANDREW.CMU.EDU (Fred Hansen) (01/03/91)
Excerpts from internet.info-andrew: 2-Jan-91 Re: catching keyclicks Tom Neuendorffer (1024+0) > The view pointer that will be returned when a key is pressed will be to > the textview itself, so that if your application has information sitting > in this search control window, it will have to be able to map the > textview to the right remote window. Then all you need then is a keymap > that takes care of all the desired keystrokes. Your code can redirect the keystrokes via im by setting the input focus whereever desired and calling im_DoKey: struct view *currentIF = im_GetInputFocus(im); view_WantInputFocus(targetview, targetview); im_DoKey(im); view_WantInputFocus(currentIF, currentIF); Unfortunately, this technique will entail a lot screen changes as the insets adjust to loss and gain of input focus. Fred Hansen