[comp.windows.x] stacking widgets

spot@CS.CMU.EDU (Scott Draves) (02/28/91)

hi all.

I am trying to stack up widgets.  That is, have several widgets that
occupy the same rectangle on the screen.  One of them is an output
widget, the rest only do input.

I tried to do this by using accelerators, all of the input widgets but
one started out with a null translation table, instead the
translations are in the XtNaccelerators resource.  Then, after
creating each widget I call XtInstallAccelerators() so that events in
the designated wiget get sent to the appropriate place.

but this doesn't work; for some reason nothing happens when I
physcally send an event (ie click the mouse).  No callback is called.

Is there any way of doing this?

the problem seems to lie somewhere in the attributes of the widgets'
windows.  they are selected to receive events, even though their
translations are (or should be) NULL.  why?
--

			christianity is stupid
Scott Draves		communism is good
spot@cs.cmu.edu		give up

swick@athena.mit.EDU (Ralph Swick) (03/01/91)

    I am trying to stack up widgets.  That is, have several widgets that
    occupy the same rectangle on the screen.  One of them is an output
    widget, the rest only do input.
...
    but this doesn't work; for some reason nothing happens when I
    physcally send an event (ie click the mouse).  No callback is called.

If the widgets are siblings, then the one with the translations
that is also the destination of the XtInstallAccelerators() had
better be on top (stack_mode Above; see Xt spec, section 6.2 or
Xlib spec, section 3.7).  Otherwise, the events will propagate
to the parent and then up the hierarchy.  If you created this
widget last, then its window actually winds up on the bottom of
the stack by default (see Xt spec, section 2.5; page 684 in the
Digital Press book).  This might not have been what you assumed
would happen.

    the problem seems to lie somewhere in the attributes of the widgets'
    windows.  they are selected to receive events, even though their
    translations are (or should be) NULL.  why?

Are you sure about this?  Have you actually checked the window
event_mask?  If this is true, it sounds like either the widget
is installing event handlers behind your back or there's a bug.