Geometry management of an unrealized widget - Motif

This is a discussion on Geometry management of an unrealized widget - Motif ; Okay, I've searched the O'Reilly books, the Xt 6 documentation, and I don't see why this is happening. I see it happening in the Xt source, but I don't know why or the "right" way to work around it. I ...

+ Reply to Thread
Results 1 to 3 of 3

Thread: Geometry management of an unrealized widget

  1. Geometry management of an unrealized widget

    Okay, I've searched the O'Reilly books, the Xt 6 documentation, and I
    don't see why this is happening. I see it happening in the Xt source,
    but I don't know why or the "right" way to work around it.

    I have a custom-written "tool tip" widget that pops up after a delay
    (specifiable via a resource) after an EnterNotify event on its parent.
    (The tip widget is actually a popup child, allowing it to be "attached"
    to any widget.) It can contain up to 3 other widgets, all created by
    the widget's Initialize method, but for simplicity's sake, let's just
    say it has one XmLabel widget. The tip widget, a subclass of XmManager,
    has its own geometry manager. It also has a tip resource, type
    XmString; this gets moved into the label widget's XmNlabelString
    resource.

    Everything works just peachy, with one exception. If the application
    changes the tip string before it is popped up the first time, Xt
    doesn't call my geometry manager method, because the label child isn't
    realized (but it is managed). As a result, the tip widget doesn't
    resize itself after the change. The label gets resized properly --
    core.width and core.height are updated -- but the parent, my tip
    widget, doesn't get involved. Once the tip widget is realized, so is
    the label, and everything works properly from that point forward.

    I've got several possible workarounds I could implement, but I'd like
    to know the consensus on what you-all feel is the *right* way to get
    this to work properly. Should I call the layout-children code, as I
    would do in the change-managed method, when my widget is realized?
    Should I detect a change to the unrealized child and go through the
    code to resize the tip widget, as it would if the geometry manager
    method were called? Or should I avoid managing the child, waiting until
    I'm managed & realized?


  2. Re: Geometry management of an unrealized widget

    "Joe Sewell" writes:

    > The label gets resized properly --
    >core.width and core.height are updated -- but the parent, my tip
    >widget, doesn't get involved.


    How about setting true to XmNallowShellResize of tip's ancestor shell
    widget ? For example,

    Widget helpwid = XtVaCreatePopupShell("TipHelpShell",
    overrideShellWidgetClass, parent, XmNallowShellResize, True, NULL);
    ----------------------------------------------------------------------
    tesigana@mtf.biglobe.ne.jp

  3. Re: Geometry management of an unrealized widget

    tesigana@mtf.biglobe.ne.jp wrote:
    > "Joe Sewell" writes:
    >
    > > The label gets resized properly --
    > >core.width and core.height are updated -- but the parent, my tip
    > >widget, doesn't get involved.

    >
    > How about setting true to XmNallowShellResize of tip's ancestor shell
    > widget ? For example,
    >
    > Widget helpwid = XtVaCreatePopupShell("TipHelpShell",
    > overrideShellWidgetClass, parent, XmNallowShellResize, True, NULL);
    > ----------------------------------------------------------------------
    > tesigana@mtf.biglobe.ne.jp


    Did that already. That's how it works just fine *if* the widget is
    realized *before* the XmNlabelString is modified.

    A perusal of the Xt code, specifically _XtMakeGeometryRequest (in
    Geometry.c) tells me that, for reasons completely unknown to me at the
    moment, the parent's GeometryManager isn't invoked if the widget or the
    parent aren't realized. I can understand it not being called if it
    isn't *managed,* but if the change happens when the widget isn't
    *realized,* then the parent doesn't even get notified that it may need
    to change its own size.

    Maybe I'm supposed to recheck the current size when the parent widget
    (my custom widget) is realized?


+ Reply to Thread