Re-Layout - Xwindows

This is a discussion on Re-Layout - Xwindows ; Hi, You might remember an installer with a "detail" button. Those one enables showing a detail area when clicked. I have started programming such a one. My problem is that the area below those button does not get resized depending ...

+ Reply to Thread
Results 1 to 9 of 9

Thread: Re-Layout

  1. Re-Layout

    Hi,

    You might remember an installer with a "detail" button.
    Those one enables showing a detail area when clicked.
    I have started programming such a one.

    My problem is that the area below those button
    does not get resized depending on its show/hide state.

    My structuring is:

    Frame
    - Form
    - RowColumn (to place "details..." button left, middle or
    right)
    - Form (for the content to show or to hide)

    Any idea on how to do this correctly?

    best regards,
    Thomas

  2. Re: Re-Layout

    On Aug 5, 3:47*am, Thomas Lehmann wrote:
    > Hi,
    >
    > You might remember an installer with a "detail" button.
    > Those one enables showing a detail area when clicked.
    > I have started programming such a one.
    >
    > My problem is that the area below those button
    > does not get resized depending on its show/hide state.
    >
    > My structuring is:
    >
    > Frame
    > * * - Form
    > * * * * - RowColumn (to place "details..." button left, middle or
    > right)
    > * * * * - Form (for the content to show or to hide)
    >
    > Any idea on how to do this correctly?
    >


    You don't say what you mean by "the area does not get
    resized". What *does* it do, and what are you expecting it
    to do? What is the parent of the frame? Is ths in your
    main window, or a separate dialog shell? Do you want the
    shell to resize? Is there room for it to resize?

    --
    Fred Kleinschmdit


  3. Re: Re-Layout

    > You don't say what you mean by "the area does not get
    > resized". What *does* it do, and what are you expecting it
    > to do? *What is the parent of the frame? *Is ths in your
    > main window, or a separate dialog shell? Do you want the
    > shell to resize? Is there room for it to resize?
    >
    > --
    > Fred Kleinschmdit


    Picture (see description later on):
    -------------------
    | Details... | <--- before clicking
    -------------------

    -------------------
    | Details... | <--- after first clicking (intented)
    | Test |
    -------------------

    -------------------
    | Details... | <--- after second clicking (intented)
    -------------------

    OK. Assume I place a button "test" in the content area which is
    initially hidden. The button is attach to all sides of that area.
    When clicking on "details..." this area gets managed but
    you still see the frame with the "details..." button inside also
    the rowcolumn around the button and the content form are
    attached together so you should see the "details..." button
    above the "test" button.

    I can only see it when manually resizing the frame by resizing
    the dialog; then the "test..." button increases or decreases in
    width and height depending on the direction of my resizing!

    Other way round. I click again on the "details..." button and the
    content form vanishes (gets unmanaged) but the area below the
    "detailed..." button is still visible....

    -------------------
    | Details... | <--- after second clicking (actually)
    | |
    -------------------

    I hope it helps to understand.
    Feel free to ask...






  4. Re: Re-Layout

    On Aug 5, 11:32*am, Iris-und-Thomas-Lehm...@t-online.de wrote:
    > > You don't say what you mean by "the area does not get
    > > resized". What *does* it do, and what are you expecting it
    > > to do? *What is the parent of the frame? *Is ths in your
    > > main window, or a separate dialog shell? Do you want the
    > > shell to resize? Is there room for it to resize?

    >
    > > --
    > > Fred Kleinschmdit

    >
    > Picture (see description later on):
    > -------------------
    > | Details... * *| * * <--- before clicking
    > -------------------
    >
    > -------------------
    > | Details... * *| * * <--- after first clicking (intented)
    > | Test * * * * * |
    > -------------------
    >
    > -------------------
    > | Details... * *| * * <--- after second clicking (intented)
    > -------------------
    >
    > OK. Assume I place a button "test" in the content area which is
    > initially hidden. The button is attach to all sides of that area.
    > When clicking on "details..." this area gets managed but
    > you still see the frame with the "details..." button inside also
    > the rowcolumn around the button and the content form are
    > attached together so you should see the "details..." button
    > above the "test" button.
    >
    > I can only see it when manually resizing the frame by resizing
    > the dialog; then the "test..." button increases or decreases in
    > width and height depending on the direction of *my resizing!
    >
    > Other way round. I click again on the "details..." button and the
    > content form vanishes (gets unmanaged) but the area below the
    > "detailed..." button is still visible....
    >
    > -------------------
    > | Details... * *| * * <--- after second clicking (actually)
    > | * * * * * * * * *|
    > -------------------
    >
    > I hope it helps to understand.
    > Feel free to ask...



    What value have you given the XmNresizePolicy of the parent form?
    What value have you given the shell's XmNallowShellResize ?

    --
    Fred Kleinschmidt

  5. Re: Re-Layout

    > What value have you given the XmNresizePolicy of the parent form?
    Default: XmRESIZE_ANY
    > What value have you given the shell's XmNallowShellResize ?

    True (set by given base class)

  6. Re: Re-Layout

    > What value have you given the XmNresizePolicy of the parent form?
    Default: XmRESIZE_ANY
    > What value have you given the shell's XmNallowShellResize ?

    True (set by given base class)

  7. Re: Re-Layout

    On 6 Aug., 16:19, Fred wrote:
    > On Aug 5, 11:32*am, Iris-und-Thomas-Lehm...@t-online.de wrote:
    >
    >
    >
    > > > You don't say what you mean by "the area does not get
    > > > resized". What *does* it do, and what are you expecting it
    > > > to do? *What is the parent of the frame? *Is ths in your
    > > > main window, or a separate dialog shell? Do you want the
    > > > shell to resize? Is there room for it to resize?

    >
    > > > --
    > > > Fred Kleinschmdit

    >
    > > Picture (see description later on):
    > > -------------------
    > > | Details... * *| * * <--- before clicking
    > > -------------------

    >
    > > -------------------
    > > | Details... * *| * * <--- after first clicking (intented)
    > > | Test * * * * * |
    > > -------------------

    >
    > > -------------------
    > > | Details... * *| * * <--- after second clicking (intented)
    > > -------------------

    >
    > > OK. Assume I place a button "test" in the content area which is
    > > initially hidden. The button is attach to all sides of that area.
    > > When clicking on "details..." this area gets managed but
    > > you still see the frame with the "details..." button inside also
    > > the rowcolumn around the button and the content form are
    > > attached together so you should see the "details..." button
    > > above the "test" button.

    >
    > > I can only see it when manually resizing the frame by resizing
    > > the dialog; then the "test..." button increases or decreases in
    > > width and height depending on the direction of *my resizing!

    >
    > > Other way round. I click again on the "details..." button and the
    > > content form vanishes (gets unmanaged) but the area below the
    > > "detailed..." button is still visible....

    >
    > > -------------------
    > > | Details... * *| * * <--- after second clicking (actually)
    > > | * * * * * * * * *|
    > > -------------------

    >
    > > I hope it helps to understand.
    > > Feel free to ask...

    >
    > What value have you given the XmNresizePolicy of the parent form?
    > What value have you given the shell's XmNallowShellResize ?
    >
    > --
    > Fred Kleinschmidt


    Afterwards a very little example to reproduce the problem!
    I'm usinge the button to show or hide the label.
    Could someone please show me how to change the code
    that the area of the label vanishes when the label vanishes?

    Thanks
    Thomas


    // ---- X11
    #include
    #include

    // ---- Motif
    #include
    #include
    #include

    struct SomeWidgets
    {
    Widget button;
    Widget label;
    };

    void activatedCB(Widget widget, XtPointer clientData, XtPointer
    widgetData)
    {
    SomeWidgets* someWidgets = (SomeWidgets*)clientData;

    if (XtIsManaged(someWidgets->label))
    {
    XtUnmanageChild(someWidgets->label);
    }//if
    else
    {
    XtManageChild(someWidgets->label);
    }//else
    }

    int main(int argc, char *argv[])
    {
    XtAppContext context = NULL;
    Display* display = NULL;

    Widget application = XtInitialize(argv[0], "", NULL, 0, &argc,
    argv);
    Widget mainForm = XmCreateForm(application,
    const_cast("main form"), 0 ,NULL);

    XtVaSetValues(mainForm, XmNtopAttachment , XmATTACH_FORM
    , XmNleftAttachment , XmATTACH_FORM
    , XmNrightAttachment , XmATTACH_FORM
    , XmNbottomAttachment, XmATTACH_FORM
    , NULL);

    // test code
    SomeWidgets someWidgets;

    someWidgets.button = XmCreatePushButton(mainForm,
    const_cast("Details..."), 0, NULL);
    someWidgets.label = XmCreateLabel(mainForm,
    const_cast("Some text"), 0, NULL);

    XtVaSetValues(someWidgets.button, XmNtopAttachment ,
    XmATTACH_FORM
    , XmNleftAttachment ,
    XmATTACH_FORM
    , XmNrightAttachment ,
    XmATTACH_FORM
    , NULL);

    XtVaSetValues(someWidgets.label , XmNtopAttachment ,
    XmATTACH_WIDGET
    , XmNtopWidget ,
    someWidgets.button
    , XmNleftAttachment ,
    XmATTACH_FORM
    , XmNrightAttachment ,
    XmATTACH_FORM
    , XmNbottomAttachment,
    XmATTACH_FORM
    , NULL);

    // when clicked (releasing the mouse button or key)
    XtAddCallback(someWidgets.button, XmNactivateCallback,
    (XtCallbackProc)activatedCB, &someWidgets);

    // show them...
    XtManageChild(mainForm);
    XtManageChild(someWidgets.button);
    XtManageChild(someWidgets.label);

    // run...
    XtRealizeWidget(application);
    XtMainLoop();
    return 0;
    }//main

  8. Re: Re-Layout

    On 11 Aug., 14:29, Thomas Lehmann wrote:
    > On 6 Aug., 16:19, Fred wrote:
    >
    >
    >
    > > On Aug 5, 11:32*am, Iris-und-Thomas-Lehm...@t-online.de wrote:

    >
    > > > > You don't say what you mean by "the area does not get
    > > > > resized". What *does* it do, and what are you expecting it
    > > > > to do? *What is the parent of the frame? *Is ths in your
    > > > > main window, or a separate dialog shell? Do you want the
    > > > > shell to resize? Is there room for it to resize?

    >
    > > > > --
    > > > > Fred Kleinschmdit

    >
    > > > Picture (see description later on):
    > > > -------------------
    > > > | Details... * *| * * <--- before clicking
    > > > -------------------

    >
    > > > -------------------
    > > > | Details... * *| * * <--- after first clicking (intented)
    > > > | Test * * * * * |
    > > > -------------------

    >
    > > > -------------------
    > > > | Details... * *| * * <--- after second clicking (intented)
    > > > -------------------

    >
    > > > OK. Assume I place a button "test" in the content area which is
    > > > initially hidden. The button is attach to all sides of that area.
    > > > When clicking on "details..." this area gets managed but
    > > > you still see the frame with the "details..." button inside also
    > > > the rowcolumn around the button and the content form are
    > > > attached together so you should see the "details..." button
    > > > above the "test" button.

    >
    > > > I can only see it when manually resizing the frame by resizing
    > > > the dialog; then the "test..." button increases or decreases in
    > > > width and height depending on the direction of *my resizing!

    >
    > > > Other way round. I click again on the "details..." button and the
    > > > content form vanishes (gets unmanaged) but the area below the
    > > > "detailed..." button is still visible....

    >
    > > > -------------------
    > > > | Details... * *| * * <--- after second clicking (actually)
    > > > | * * * * * * * * *|
    > > > -------------------

    >
    > > > I hope it helps to understand.
    > > > Feel free to ask...

    >
    > > What value have you given the XmNresizePolicy of the parent form?
    > > What value have you given the shell's XmNallowShellResize ?

    >
    > > --
    > > Fred Kleinschmidt

    >
    > Afterwards a very little example to reproduce the problem!
    > I'm usinge the button to show or hide the label.
    > Could someone please show me how to change the code
    > that the area of the label vanishes when the label vanishes?


    Ok. I found out myself that "allow shell resize" does the job BUT
    only for this example code. I have extended the test by using a
    "content" form around the label. Now the resizing isn't working
    anymore....

  9. Re: Re-Layout

    On Aug 11, 5:29*am, Thomas Lehmann wrote:
    > On 6 Aug., 16:19, Fred wrote:
    >
    >
    >
    >
    >
    > > On Aug 5, 11:32*am, Iris-und-Thomas-Lehm...@t-online.de wrote:

    >
    > > > > You don't say what you mean by "the area does not get
    > > > > resized". What *does* it do, and what are you expecting it
    > > > > to do? *What is the parent of the frame? *Is ths in your
    > > > > main window, or a separate dialog shell? Do you want the
    > > > > shell to resize? Is there room for it to resize?

    >
    > > > > --
    > > > > Fred Kleinschmdit

    >
    > > > Picture (see description later on):
    > > > -------------------
    > > > | Details... * *| * * <--- before clicking
    > > > -------------------

    >
    > > > -------------------
    > > > | Details... * *| * * <--- after first clicking (intented)
    > > > | Test * * * * * |
    > > > -------------------

    >
    > > > -------------------
    > > > | Details... * *| * * <--- after second clicking (intented)
    > > > -------------------

    >
    > > > OK. Assume I place a button "test" in the content area which is
    > > > initially hidden. The button is attach to all sides of that area.
    > > > When clicking on "details..." this area gets managed but
    > > > you still see the frame with the "details..." button inside also
    > > > the rowcolumn around the button and the content form are
    > > > attached together so you should see the "details..." button
    > > > above the "test" button.

    >
    > > > I can only see it when manually resizing the frame by resizing
    > > > the dialog; then the "test..." button increases or decreases in
    > > > width and height depending on the direction of *my resizing!

    >
    > > > Other way round. I click again on the "details..." button and the
    > > > content form vanishes (gets unmanaged) but the area below the
    > > > "detailed..." button is still visible....

    >
    > > > -------------------
    > > > | Details... * *| * * <--- after second clicking (actually)
    > > > | * * * * * * * * *|
    > > > -------------------

    >
    > > > I hope it helps to understand.
    > > > Feel free to ask...

    >
    > > What value have you given the XmNresizePolicy of the parent form?
    > > What value have you given the shell's XmNallowShellResize ?

    >
    > > --
    > > Fred Kleinschmidt

    >
    > Afterwards a very little example to reproduce the problem!
    > I'm usinge the button to show or hide the label.
    > Could someone please show me how to change the code
    > that the area of the label vanishes when the label vanishes?
    >
    > Thanks
    > Thomas
    >
    > // ---- X11
    > #include
    > #include
    >
    > // ---- Motif
    > #include
    > #include
    > #include
    >
    > struct SomeWidgets
    > {
    > * * Widget button;
    > * * Widget label;
    >
    > };
    >
    > void activatedCB(Widget widget, XtPointer clientData, XtPointer
    > widgetData)
    > {
    > * * SomeWidgets* someWidgets = (SomeWidgets*)clientData;
    >
    > * * if (XtIsManaged(someWidgets->label))
    > * * {
    > * * * * XtUnmanageChild(someWidgets->label);


    You have a problem here. You are unmanaging the label, but it
    still has attachments set to its form parent. What you need to
    do here is reset the bottom attachment to the button:
    XtVaSetValues( someWidgets->button,
    XmNbottomAttachment, XmATTACH_FORM,
    NULL);

    > * * }//if
    > * * else
    > * * {


    And then here you should re-establish the attachments needed
    to properly show the label again. Do this BEFORE you mkanage
    the label:
    XtVaSetValues( someWidgets->button,
    XmNbottomAttachment, XmATTACH_NONE,
    NULL);

    Note that the label still has the proper attachments, so you do
    not need to reset anything for it.

    > * * * * XtManageChild(someWidgets->label);
    > * * }//else
    >
    > }
    >
    > int main(int argc, char *argv[])
    > {
    > * * XtAppContext context = NULL;
    > * * Display* * * display = NULL;
    >
    > * * Widget application = XtInitialize(argv[0], "", NULL, 0, &argc,
    > argv);
    > * * Widget mainForm * *= XmCreateForm(application,
    > const_cast("main form"), 0 ,NULL);
    >
    > * * XtVaSetValues(mainForm, XmNtopAttachment * , XmATTACH_FORM
    > * * * * * * * * * * * * * , XmNleftAttachment *, XmATTACH_FORM
    > * * * * * * * * * * * * * , XmNrightAttachment , XmATTACH_FORM
    > * * * * * * * * * * * * * , XmNbottomAttachment, XmATTACH_FORM
    > * * * * * * * * * * * * * , NULL);



    The above SetValues does nothing, since mainForm is not the
    child of an XmForm. the attachment resources are constraint
    resources to be placed on children of an XmForm, not on the
    XmForm itself.

    >
    > * * // test code
    > * * SomeWidgets someWidgets;
    >
    > * * someWidgets.button = XmCreatePushButton(mainForm,
    > const_cast("Details..."), 0, NULL);
    > * * someWidgets.label *= XmCreateLabel(mainForm,
    > const_cast("Some text"), 0, NULL);
    >
    > * * XtVaSetValues(someWidgets.button, XmNtopAttachment * ,
    > XmATTACH_FORM
    > * * * * * * * * * * * * * * * * * * ,XmNleftAttachment *,
    > XmATTACH_FORM
    > * * * * * * * * * * * * * * * * * * ,XmNrightAttachment ,
    > XmATTACH_FORM
    > * * * * * * * * * * * * * * * * * * ,NULL);
    >
    > * * XtVaSetValues(someWidgets.label , XmNtopAttachment * ,
    > XmATTACH_WIDGET
    > * * * * * * * * * * * * * * * * * * ,XmNtopWidget * * * ,
    > someWidgets.button
    > * * * * * * * * * * * * * * * * * * ,XmNleftAttachment *,
    > XmATTACH_FORM
    > * * * * * * * * * * * * * * * * * * ,XmNrightAttachment ,
    > XmATTACH_FORM
    > * * * * * * * * * * * * * * * * * * ,XmNbottomAttachment,
    > XmATTACH_FORM
    > * * * * * * * * * * * * * * * * * * ,NULL);
    >
    > * * // when clicked (releasing the mouse button or key)
    > * * XtAddCallback(someWidgets.button, XmNactivateCallback,
    > (XtCallbackProc)activatedCB, &someWidgets);
    >
    > * * // show them...
    > * * XtManageChild(mainForm);
    > * * XtManageChild(someWidgets.button);
    > * * XtManageChild(someWidgets.label);


    In general, it is better to manage the children before managing the
    parent (mainForm); it eliminates extra geometry negotiations.

    > * * // run...
    > * * XtRealizeWidget(application);
    > * * XtMainLoop();
    > * * return 0;
    >


    --
    Fred Kleinschmidt

+ Reply to Thread