XForms: problem with tabfolder->form->x,y

From: Angus Leeming (a.leeming@ic.ac.uk)
Date: Thu Nov 02 2000 - 10:16:02 EST

  • Next message: Steve Lamont: "Re: XForms: problem with tabfolder->form->x,y"

    # To subscribers of the xforms list from Angus Leeming <a.leeming@ic.ac.uk> :

    I think that this is a bug in xforms. Whether that's true or not, is a
    request for info leading to a work around.

    Here's the problem.

    I have a dialog containing a nested tabfolder. That is, an outer tabfolder,
    each tab of which contains a second (inner) tab folder. On this inner tab I
    have a combox (my own object class), which consists of a label, a button and
    a new form containing a browser only.

    Press on the combox->button to show the drop down browser.
    Select an item and the browser dissappears. All fine and dandy.

    Here's a working scenario:
    Launch the dialog.
    Select the tabfolder containing the combox.
    Press the combox button.
    The combox->browser is displayed immediately underneath the combox->label. As
    it should be.

    The problem arises when I reposition the dialog. It appears that
    repositioning the dialog leads to an update of the parent form's x, y data,
    but not that of the forms in the tabfolders. These are only updated when the
    tabfolder is entered. If the tabfolder is active, then the dialog is moved,
    tabfolder->form->x,y contain the old info.

    Thus code:
    void Combox::Show()
    {
            ...
            int x = combox->label->form->x + combox->label->x;
            int y = combox->label->form->y + combox->label->y;
            fl_set_form_position(combox->form, x, (y + combox->label->h));
            fl_show_form(form, FL_PLACE_POSITION, FL_NOBORDER, "");
            ...
    }
    works when combox->label->form has not been moved or when the form is the
    main dialog form, but fails if combox->label->form is a child form. (By fail,
    I mean that the browser is displayed in the old position, not the new one,
    immediately underneathe the combox->label.)

    I have a partial fix:
    void Combox::Show()
    {
            ...
            int x = combox->label->x;
            int y = combox->label->y;
            FL_FORM * parent = combox->label->form;
            while( parent->parent ) {
                    parent = parent->parent;
            }
            x += parent->x;
            y += parent->y;
            if( parent != combox->label->form ) {
                    x += 10;
                    y += 60;
            }

            fl_set_form_position(combox->form, x, (y + combox->label->h));
    }

    The fudge is obvious! I can get the true position of the window form, but
    don't know the offset of the child (tabfolder) form from it (10,60) in this
    case!

    Intriguingly, if I move the dialog, but then open up the folder again (ie
    change folders and change back) then the folder's form position is set
    correctly. Is there anyway I can force this reset to happen?

    Hope I haven't bored you to death and that a solution is obvious!
    Best wishes,
    Angus
    _________________________________________________
    To unsubscribe, send the message "unsubscribe" to
    xforms-request@bob.usuhs.mil or see
    http://bob.usuhs.mil/mailserv/xforms.html
    XForms Home Page: http://world.std.com/~xforms
    List Archive: http://bob.usuhs.mil/mailserv/list-archives/



    This archive was generated by hypermail 2b29 : Thu Nov 02 2000 - 10:18:42 EST