[comp.windows.x] Binding events in one widget to another

morreale@bierstadt.scd.ucar.edu (Peter Morreale) (06/26/91)

Question for Xt folks....

Suppose I have a Command button and asciitext widget in an app.  I'd
like to bind a RETURN in the text widget to a Button1 press in the
command widget.  In other words, if the user hits a RETURN in the text,
the command widget acts as if it had received a button click. (enter, down and
release)

It would be trivial to bind an action to the text widget to execute the
command button callback, but what I'm after is the highlighting in the
command button.  (this is what I'm doing now, I just don't have the
visual effects...)

Ideally, I'd like the text widget's "EnterNotify" event to get passed to
the command so that the command's "highlight()" action is called, then
the "<Key>Return" in the text widget does the command button's "set()
notify() unset()" actions.  (I'd also like the text's "LeaveNotify"
event to execute the command's "unhighlight()" action.....)

In short, I want to bind the visual effects of events in the command
widget executed from events in the text widget.

How do I do this?

Thanks
-PWM
-- 
------------------------------------------------------------------
Peter W. Morreale                  email:  morreale@ncar.ucar.edu
Nat'l Center for Atmos Research    voice:  (303) 497-1293
Scientific Computing Division     
Consulting Office
------------------------------------------------------------------

asente@adobe.com (Paul Asente) (06/29/91)

In article <11935@ncar.ucar.edu> morreale@bierstadt.scd.ucar.edu (Peter Morreale) writes:
>Suppose I have a Command button and asciitext widget in an app.  I'd
>like to bind a RETURN in the text widget to a Button1 press in the
>command widget....

This is exactly what accelerators do.  Read up on accelerators.

	-paul asente
		asente@adobe.com	...decwrl!adobe!asente

    Ratz put a bucket of liquid in front of me.
   "I wanted a glass of docs, Ratz.  What the hell is this?" I barked.
   "Motif don't fit in a glass anymore," he barked back.
    I looked at the liquid.  It was totally opaque to me.