[comp.windows.x] No expose event for newly created widget

geoff@tolerant.com (Geoffrey Leach) (08/03/90)

I have this problem and I've exhausted my personal resources on it.
Any ideas would be appreciated.

I have this hierarchy of composite widgets that are layered.  For instance,
A, B and C sit on top of X (their mutual parent).  The parent is just large
enough for the three kids, plus a text label.

The widgets are created with trivial width and height.  The "real" values
are computed after creation using a SetValues procedure.  The parent
provides a resize procedure, which assigns height and width if the 
child's not realized, or calls XtResizeWdiget if it is.

The children are positioned by the parent's expose procedure, which calls
XtMoveWidget to do the job.

If all of this  happens before the widget tree is realized, everything works
fine.  If it is called after the tree is realized -- in the process of adding
children to an existing parent -- an expose event for only one child is
generated.  Neither the parent nor the other children get exposed.

As best I can tell, there's nothing strange about the widgets in question.
They are all mapped, managed and realized.  The new widgets are created
with XtCreateManagedWidget.

Any ideas? (I'm giving serious consideration to moving to Tibet :-)).

swick@ATHENA.MIT.EDU (Ralph Swick) (08/07/90)

    The children are positioned by the parent's expose procedure,

This sounds like a mistake.  There are a variety of ways in which
the parent's size can change without generating an expose event.
At minimum, you should [also] position the children in the
parent's change_managed and resize procedures.

    ...after the tree is realized -- in the process of adding
    children to an existing parent -- an expose event for only one child is
    generated.  Neither the parent nor the other children get exposed.

Unless a sibling was obscured and then uncovered by the new child,
or was itself resized, there's no reason to expect exposure events
for the other children.  If the new child completely obscures the
new bits added to the parent's shape, then no exposure event will be
generated for the parent either.

I guess we can't help you without more information.