XForms: Updating tabfolder position

From: Angus Leeming (a.leeming@ic.ac.uk)
Date: Mon May 20 2002 - 06:11:46 EDT

  • Next message: iti@perfectlyprivate.net: "XForms: executing and libform"

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

    Hi,

    There is a bug in the present (0.9999) implementation of the tabfolders. The
    form->x, form->y positions of the tabfolder leaves' FL_FORMs are not updated
    when the parent dialog is moved.

    The problem manifests itself when I try and display a combox's browser; it
    pops up in the wrong place unless I hack the code. (A combox is a button and
    a browser in it's own FL_FORM. Press the button and the browser is displayed.)

    I described this bug on the xforms list a /long/ time ago and Steve suggested
    a workaround, but it'd be nice if it were to be squashed properly. Is there a
    fix for this in TC's bunch of fixes?

    FYI, here's the current code.
    Angus

    void Combox::show()
    {
            if (_pre) _pre();

            int tmp;
            XGetInputFocus(fl_get_display(), &save_window, &tmp); //BUG-Fix Dietmar
            XFlush(fl_get_display());
            if (button && type != FL_COMBOX_NORMAL) {
                    fl_set_object_label(button, "@2<-");
                    fl_redraw_object(button);
            }

            int x = label->x;
            int y = label->y + label->h;
            if (tabfolder1) {
                    // This is a bug work around suggested by Steve Lamont on the
                    // xforms mailing list. It correctly positions the browser form
                    // after the main window has been moved.
                    // The bug only occurs in tabbed folders.
                    int folder_x, folder_y, folder_w, folder_h;
                    fl_get_folder_area( tabfolder1,
                                        &folder_x, &folder_y,
                                        &folder_w, &folder_h);
                    x += folder_x;
                    y += folder_y;

                    if (tabfolder2) {
                            fl_get_folder_area( tabfolder2,
                                                &folder_x, &folder_y,
                                                &folder_w, &folder_h);
                            x += tabfolder2->form->x + folder_x;
                            y += tabfolder2->form->y + folder_y;
                    } else {
                            x += tabfolder1->form->x;
                            y += tabfolder1->form->y;
                    }

            } else {
                    x += label->form->x;
                    y += label->form->y;
            }

            fl_set_form_position(form, x, y);
            fl_show_form(form, FL_PLACE_POSITION, FL_NOBORDER, "");
            if (sel > 0) {
                    fl_set_browser_topline(browser, sel);
                    fl_select_browser_line(browser, sel);
            }
            XGrabPointer(fl_get_display(), form->window, false,
                         ButtonPressMask | ButtonReleaseMask | PointerMotionMask,
                         GrabModeAsync, GrabModeAsync,
                         0, 0, 0);
            XFlush(fl_get_display());
    }
    _________________________________________________
    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 : Mon May 20 2002 - 06:12:18 EDT