From: lanzo@tekelec.com (Mark Lanzo)
Subject: Questions and problems with RowColumn widget
Keywords: X11R4, Motif 1.1.2
Organization: Tekelec Inc., Raleigh NC
Date: Fri, 22 Jan 1993 19:34:15 GMT

[Apologies if any of these have answers in the FAQ -- I haven't
seen an FAQ here for a while, but our news feed is pretty flaky
and loses articles from time to time.]

I've run into a few problems with the RowColumn widget; 
let's see if anyone else can shed some light on these ...

1)  RowColumn Widget does not always seem to know its own size.

    I was trying to create several widgets and adjust their
    sizes so that they were layed out neatly in a form I was 
    creating (*sigh*  I wish XmForm's attachment mechanisms
    were better).  I had a chunk of code which effectively
    went like this:

     |  //  Set up an option menu ...
     |
     |  menuPane = XmCreatePulldownMenu(parent, menuPaneName, NULL, 0);
     |
     |  menuRC = XtVaCreateManagedWidget(  menuName, 
     |      xmRowColumnWidgetClass,        parent,
     |      XmNrowColumnType,              XmMENU_OPTION,
     |      XmNsubMenuId,                  menuPane,
     |      NULL);
     |
     |  //  Add some option buttons to the menu, for example: 
     |
     |  button = XtVaCreateManagedWidget(  buttonName,
     |      xmPushButtonGadgetClass,       menuPane,
     |      NULL);
     |
     |  //  See how tall the widget is:
     |
     |  XtVaGetValues(menuRC, XmNheight, &height, NULL);

    At this stage of the game I found that the height value which
    was returned was totally bogus.  Peculiarly enough, if I 
    tried to alter the height value, and then tried to read it back,
    I then seemed to get a more reasonable value.  Example:

     |  height = 100;
     |  XtVaSetValues(menuRC, XmNheight, height, NULL);
     |  XtVaGetValues(menuRC, XmNheight, &height, NULL);

    OK, so now I get an accurate value for the height -- but it's
    not the value I just set!  The widget seems to refuse to accept
    the new height value, but in the process it seems to have at
    least updated its own notion of its height, so that the 
    subsequent GetValues call now returns the actual height.

    What's going on here?  [And yes, the datatypes are right;
    for instance "height" is a "Dimension" not an "int"].


2)  The anonymous cascade button child in an option menu RowColumn
    widget does not have the correct label alignment.

    The options in the option menu inherit their XmNalignment
    value from the XmNentryAlignment value of their parent
    pulldown menu.  However, the label on the cascade button
    in the associated option menu always has centered alignment,
    regardless of the alignment of the labels for the buttons
    in the popup menu pane.

    I tried setting the XmNentryAlignment resource on the option
    menu itself, but this seems to have no affect on the cascade
    button which RowColumn creates as a trigger for the menu pane.

    Is their a resource I don't know about here to fix this?
    I realize that I could probably call XmOptionButtonGadget()
    and force the alignment on the cascade button from within
    my code, but I don't want to hardcode this;  I'd rather 
    have it pick up a resource from my resource (app-defaults) file.


3)  Option menu doesn't adjust its size in response to a change
    in one of its children.

    One of the reasons I was doing all this was to put up a set
    of option menus in a form, with all the menus lined up
    neatly on the left:

         A short label:            [OPTION-MENU-1]

         A somewhat longer label:  [OPTION-MENU-2]

         Third item:               [OPTION-MENU-3]
             
                                   ^ aligned here.

    On my first attempt, I just used the label gadget provided
    by the option menu itself -- I called XmOptionLabelGadget()
    for each option menu I created and then adjusted all the 
    labels to be as wide as the longest label.  This worked,
    except that the RowColumn widget didn't expand to accommodate
    the wider labels, and the cascade gadget got clipped in
    some cases.

    I ended up creating my own label gadgets and just totally
    disposing of the labelString functionality present within
    a RowColumn configured as on option menu.  But this is 
    another story, with its own problems ... :-(

    On a related note - why can't I create a cascade button with
    any arbitrary parent widget?  It seems very silly to create
    a row column widget which has no use whatsoever except to hold
    a solitary cascade button gadget, just so I can have an
    option menu.  Or have I missed something?


4)  Need different relation between XmNorientation and XmNnumColumns 
    for 2D arrays.

    Is there any way to have a RowColumn widget where I specify
    the orientation and number of items I want in the minor
    dimension, and have the RowColumn fill entries along the
    minor dimension and create new major entries as needed?

    For example, I want to create a RowColumn widget (with
    packing = PACK_COLUMN) where I have 5 columns.  I want
    child widgets to be added left-to-right, top-to-bottom;
    creating additional rows as necessary.


Help greatly appreciated -- thanks in advance!

	--mark--

+--------------------------------------------------------+------- /// -----+
| Mark Lanzo   KD4QLZ   lanzo@tekelec.com   919-460-5576 |    \\\///       |
+--------------------------------------------------------+---- \XX/ -------+
Newsgroups: comp.windows.x.motif