Laying Out Buttons in a Form - Motif

This is a discussion on Laying Out Buttons in a Form - Motif ; I have three buttons laid out horizontally within a form. The first two buttons are sized according to the label, the right-most button stretches to fill the available space. What can I specify so that all three buttons are uniformally ...

+ Reply to Thread
Results 1 to 9 of 9

Thread: Laying Out Buttons in a Form

  1. Laying Out Buttons in a Form


    I have three buttons laid out horizontally within a form. The first two
    buttons are sized according to the label, the right-most button stretches to
    fill the available space. What can I specify so that all three buttons are
    uniformally sized within the form?

    Here is my UIL showing what I currently have:

    object ABSTagTradeForm : XmForm {
    controls{
    XmPushButton ABSTagButton;
    XmPushButton ABSCommentsButton;
    XmPushButton ABSTradeButton;
    };
    };

    object ABSTagButton: XmPushButton {
    arguments {
    XmNtopAttachment = XmATTACH_FORM;
    XmNbottomAttachment = XmATTACH_FORM;
    XmNleftAttachment = XmATTACH_FORM;
    XmNrightAttachment = XmATTACH_NONE;
    XmNlabelString = "Tags...";
    };
    callbacks {
    XmNactivateCallback = procedure manageTransientWindowCB("Tag Dialog");
    };
    };

    object ABSCommentsButton: XmPushButton {
    arguments {
    XmNtopAttachment = XmATTACH_FORM;
    XmNbottomAttachment = XmATTACH_FORM;
    XmNleftAttachment = XmATTACH_WIDGET;
    XmNleftWidget = ABSTagButton;
    XmNrightAttachment = XmATTACH_NONE;
    XmNlabelString = 'Comments...';
    };
    callbacks {
    MrmNcreateCallback = procedure bindCB("AttributesButton");
    XmNactivateCallback = procedure manageTransientWindowCB("Attributes");
    };
    };

    object ABSTradeButton: XmPushButton {
    arguments {
    XmNtopAttachment = XmATTACH_FORM;
    XmNbottomAttachment = XmATTACH_FORM;
    XmNleftAttachment = XmATTACH_WIDGET;
    XmNleftWidget = ABSCommentsButton;
    XmNrightAttachment = XmATTACH_FORM;
    XmNlabelString = 'Trade...';
    };
    callbacks {
    MrmNcreateCallback = procedure bindCB("TradeEntryButton");
    XmNactivateCallback = procedure manageTransientWindowCB("TradeEntry");
    };
    };



    --
    Jake Colman

    Principia Partners LLC Phone: (201) 209-2467
    Harborside Financial Center Fax: (201) 946-0320
    902 Plaza Two E-mail: colman@ppllc.com
    Jersey City, NJ 07311 www.principiapartners.com

  2. Re: Laying Out Buttons in a Form

    Jake Colman wrote in
    news:76isjphvdi.fsf@newjersey.ppllc.com:
    > I have three buttons laid out horizontally within a form. The first two
    > buttons are sized according to the label, the right-most button
    > stretches to fill the available space. What can I specify so that all
    > three buttons are uniformally sized within the form?


    Attach position to 33% of the form width.

    Ken Lee, http://www.rahul.net/kenton/

  3. Re: Laying Out Buttons in a Form

    >>>>> "KL" == Ken Lee writes:

    KL> Jake Colman wrote in
    KL> news:76isjphvdi.fsf@newjersey.ppllc.com:
    >> I have three buttons laid out horizontally within a form. The first two
    >> buttons are sized according to the label, the right-most button
    >> stretches to fill the available space. What can I specify so that all
    >> three buttons are uniformally sized within the form?


    KL> Attach position to 33% of the form width.

    I have to ask a dumb question but how, exactly, do I specify this in UIL
    attributes?

    --
    Jake Colman

    Principia Partners LLC Phone: (201) 209-2467
    Harborside Financial Center Fax: (201) 946-0320
    902 Plaza Two E-mail: colman@ppllc.com
    Jersey City, NJ 07311 www.principiapartners.com

  4. Re: Laying Out Buttons in a Form

    Jake Colman wrote:
    > KL> Attach position to 33% of the form width.
    >
    > I have to ask a dumb question but how, exactly, do I specify this in UIL
    > attributes?


    I concurr, I would also very much like to know how % of form width can be
    specified in a UIL.

  5. Re: Laying Out Buttons in a Form

    >>>>> "JM" == JF Mezei writes:

    JM> Jake Colman wrote:
    KL> Attach position to 33% of the form width.
    >>
    >> I have to ask a dumb question but how, exactly, do I specify this in UIL
    >> attributes?


    JM> I concurr, I would also very much like to know how % of form width can be
    JM> specified in a UIL.

    The answer is to specify the attachment as XmATTACH_POSITION and the use
    XmNxxxPosition attribute with a value.

    Below is the mmodified UIL. As you can see, ABSTagButton has a right
    attachement at 33, ABSCommentsButton has a left attachment to the widget and
    a right attachment at 66, and ABSTradeButton simple does a left attachment to
    the widget and a right attachment to the form.

    object ABSTagTradeForm : XmForm {
    controls{
    XmPushButton ABSTagButton;
    XmPushButton ABSCommentsButton;
    XmPushButton ABSTradeButton;
    };
    arguments {
    };
    };

    object ABSTagButton: XmPushButton {
    arguments {
    XmNtopAttachment = XmATTACH_FORM;
    XmNbottomAttachment = XmATTACH_FORM;
    XmNleftAttachment = XmATTACH_FORM;
    XmNrightAttachment = XmATTACH_POSITION;
    XmNrightPosition = 33;
    XmNlabelString = "Tags...";
    };
    callbacks {
    XmNactivateCallback = procedure manageTransientWindowCB("Tag Dialog");
    };
    };

    object ABSCommentsButton: XmPushButton {
    arguments {
    XmNtopAttachment = XmATTACH_FORM;
    XmNbottomAttachment = XmATTACH_FORM;
    XmNleftAttachment = XmATTACH_WIDGET;
    XmNleftWidget = ABSTagButton;
    XmNrightAttachment = XmATTACH_POSITION;
    XmNrightPosition = 66;
    XmNlabelString = 'Comments...';
    };
    callbacks {
    MrmNcreateCallback = procedure bindCB("AttributesButton");
    XmNactivateCallback = procedure manageTransientWindowCB("Attributes");
    };
    };

    object ABSTradeButton: XmPushButton {
    arguments {
    XmNtopAttachment = XmATTACH_FORM;
    XmNbottomAttachment = XmATTACH_FORM;
    XmNleftAttachment = XmATTACH_WIDGET;
    XmNleftWidget = ABSCommentsButton;
    XmNrightAttachment = XmATTACH_FORM;
    XmNlabelString = 'Trade...';
    };
    callbacks {
    MrmNcreateCallback = procedure bindCB("TradeEntryButton");
    XmNactivateCallback = procedure manageTransientWindowCB("TradeEntry");
    };
    };



    --
    Jake Colman

    Principia Partners LLC Phone: (201) 209-2467
    Harborside Financial Center Fax: (201) 946-0320
    902 Plaza Two E-mail: colman@ppllc.com
    Jersey City, NJ 07311 www.principiapartners.com

  6. Re: Laying Out Buttons in a Form



    Jake Colman wrote:
    >
    > >>>>> "JM" == JF Mezei writes:

    >
    > JM> Jake Colman wrote:
    > KL> Attach position to 33% of the form width.
    > >>
    > >> I have to ask a dumb question but how, exactly, do I specify this in UIL
    > >> attributes?

    >
    > JM> I concurr, I would also very much like to know how % of form width can be
    > JM> specified in a UIL.
    >
    > The answer is to specify the attachment as XmATTACH_POSITION and the use
    > XmNxxxPosition attribute with a value.
    >
    > Below is the mmodified UIL. As you can see, ABSTagButton has a right
    > attachement at 33, ABSCommentsButton has a left attachment to the widget and
    > a right attachment at 66, and ABSTradeButton simple does a left attachment to
    > the widget and a right attachment to the form.
    >
    > object ABSTagTradeForm : XmForm {
    > controls{
    > XmPushButton ABSTagButton;
    > XmPushButton ABSCommentsButton;
    > XmPushButton ABSTradeButton;
    > };
    > arguments {
    > };
    > };
    >
    > object ABSTagButton: XmPushButton {
    > arguments {
    > XmNtopAttachment = XmATTACH_FORM;
    > XmNbottomAttachment = XmATTACH_FORM;
    > XmNleftAttachment = XmATTACH_FORM;
    > XmNrightAttachment = XmATTACH_POSITION;
    > XmNrightPosition = 33;
    > XmNlabelString = "Tags...";
    > };
    > callbacks {
    > XmNactivateCallback = procedure manageTransientWindowCB("Tag Dialog");
    > };
    > };
    >
    > object ABSCommentsButton: XmPushButton {
    > arguments {
    > XmNtopAttachment = XmATTACH_FORM;
    > XmNbottomAttachment = XmATTACH_FORM;
    > XmNleftAttachment = XmATTACH_WIDGET;
    > XmNleftWidget = ABSTagButton;
    > XmNrightAttachment = XmATTACH_POSITION;
    > XmNrightPosition = 66;
    > XmNlabelString = 'Comments...';
    > };
    > callbacks {
    > MrmNcreateCallback = procedure bindCB("AttributesButton");
    > XmNactivateCallback = procedure manageTransientWindowCB("Attributes");
    > };
    > };
    >
    > object ABSTradeButton: XmPushButton {
    > arguments {
    > XmNtopAttachment = XmATTACH_FORM;
    > XmNbottomAttachment = XmATTACH_FORM;
    > XmNleftAttachment = XmATTACH_WIDGET;
    > XmNleftWidget = ABSCommentsButton;
    > XmNrightAttachment = XmATTACH_FORM;
    > XmNlabelString = 'Trade...';
    > };
    > callbacks {
    > MrmNcreateCallback = procedure bindCB("TradeEntryButton");
    > XmNactivateCallback = procedure manageTransientWindowCB("TradeEntry");
    > };
    > };
    >
    >
    > --
    > Jake Colman
    >
    > Principia Partners LLC Phone: (201) 209-2467
    > Harborside Financial Center Fax: (201) 946-0320
    > 902 Plaza Two E-mail: colman@ppllc.com
    > Jersey City, NJ 07311 www.principiapartners.com



    Make sure you also set the XmNfractionBase resource of the form to 100.
    This is the default, but if the user has a setting in some XDefaults
    file that alters that, she will get strange results. For example, if she
    has:
    ?*fractionBase: 200
    your buttons will be scrunched up in the left half of the form.
    If she has:
    ?*fractionBase: 50
    bad things will happen.

    --
    Fred L. Kleinschmidt
    Boeing Associate Technical Fellow
    Technical Architect, Common User Interface Services
    M/S 2R-94 (206)544-5225

  7. Re: Laying Out Buttons in a Form

    Jake Colman wrote:
    > XmNrightAttachment = XmATTACH_POSITION;
    > XmNrightPosition = 33;


    What is the magic trick to tell the UIL compiler that the value "33" is a
    percentage versus an absolute position in pixels ?

  8. Re: Laying Out Buttons in a Form

    >>>>> "JM" == JF Mezei writes:

    JM> Jake Colman wrote:
    >> XmNrightAttachment = XmATTACH_POSITION;
    >> XmNrightPosition = 33;


    JM> What is the magic trick to tell the UIL compiler that the value "33" is a
    JM> percentage versus an absolute position in pixels ?

    Hmmmm. Don't you use the XmNxxOffset to specify absolute pixel postioning?
    XmATTACH_POSITION, then, is always percentages. At least I _think_ that's
    how it works?

    --
    Jake Colman

    Principia Partners LLC Phone: (201) 209-2467
    Harborside Financial Center Fax: (201) 946-0320
    902 Plaza Two E-mail: colman@ppllc.com
    Jersey City, NJ 07311 www.principiapartners.com

  9. Re: Laying Out Buttons in a Form

    Jake Colman wrote:
    > Hmmmm. Don't you use the XmNxxOffset to specify absolute pixel postioning?
    > XmATTACH_POSITION, then, is always percentages. At least I _think_ that's
    > how it works?


    Thanks. I stand corrected. I had looked some time ago and had concluded it was
    not possible to do relative positioning (percentage of width), but in the end,
    I had *assumed* POSITION was absolute position whereas "offset" was offset
    from the gizmo to which the widget was being positioned against.

    This is great. I had been looking for such functionality and there it was
    right in front of me and I couldn't read it :-)

+ Reply to Thread