Re: XForms: Drawing in the browser prehandler (better solution)

From: Angus Leeming (angus.leeming@btopenworld.com)
Date: Tue Apr 08 2003 - 05:54:49 EDT

  • Next message: Jean-Marc Lasgouttes: "Re: XForms: XForms seems to be in good hands"

    # To subscribers of the xforms list from Angus Leeming <angus.leeming@btopenworld.com> :

    On Tuesday 08 April 2003 1:13 am, jac@casurgica.com wrote:
    > # To subscribers of the xforms list from jac@casurgica.com :
    >
    > Ok I found a much better solution than that hack with
    > fl_set_ignore_drawing() or whatever I called it. Since the browser itself
    > doesn't do any drawing, and since I'm only really interesting in drawing
    > the text differently, it makes sense to do my custom drawing in the
    > *textbox* prehandler, rather than in the browser's prehandler (duh...). So
    > I did this in my test program:
    >
    > FL_HANDLEPTR s_oldtbpre = 0;
    >
    > void convert_browser (FL_OBJECT *br) {
    > FL_OBJECT *tb = fl_get_object_component(br, FL_TEXTBOX, -1, 0);
    > s_oldtbpre = fl_set_object_prehandler(tb, &br2_prehandler);
    > };
    >
    > Tada. A simple (and glaringly obvious, now that I think about it)
    > solution. I call s_oldtbpre() from my prehandler. It's OK, I think, to
    > store the old callback pointer this way, because even when I'm dealing
    > with multiple "custom" browsers at once, the default textbox prehandler
    > will be the same for all of them (fl_create_browser sets it to tbpre()),
    > so fl_set_object_prehandler() will return the same pointer for every
    > browser's component textbox (the first time you call it for each browser's
    > textbox, anyway, of course).
    >
    > That seems like the right thing to do... is any of this taboo at all? I'd
    > rather do it right then hack it... but I'm kind of new to xforms so I
    > don't have a good feel for what is acceptable practice yet.

    If it works, its acceptable. I didn't know that function existed :-(
    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/
    Development: http://savannah.nongnu.org/files/?group=xforms



    This archive was generated by hypermail 2b29 : Tue Apr 08 2003 - 09:37:38 EDT