XForms: interrogating a scrollbar

From: Angus Leeming (a.leeming@ic.ac.uk)
Date: Mon Dec 02 2002 - 13:38:10 EST

  • Next message: McCormick Bruce R CONT DLVA: "RE: XForms: problem with fl_set_idle_delta in 1.0 RC 5.2"

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

    Dear all (especially Steve ;-),

    I think that I've got to the bottom of this problem but would like to probe
    your thoughts about the best way forward. What are your feelings about my
    "Possible solutions" and can you see another way?

    Regards,
    Angus

    ==================== The problem =====================
    an xforms scrollbar object contains the following separate widgets:
            FL_OBJECT * slider;
            FL_OBJECT * up;
            FL_OBJECT * down;
    being the slider itself and the trough on either side of this slider.

    Is there any way of interrogating a scrollbar to ascertain which widget has
    generated the callback/event?

    ======================= Why ==========================
    I'm using the scrollbar to control which part of a document is visible. I'd
    like to encode the following behaviour:

    * For the slider, a mouse event is to be processed immediately by going to
    that line in the document.
    * For the trough, I'd like to "increment 1 page" per mouse event together
    with a "reasonable delay" between increments (so that I can control position,
    not just whizz to the end of the document).

    I can see that to do this, I'll need to call a prehandler that starts a timer
    (a bit like the tooltip code) if the mouse button press originates in the
    trough. Subsequent FL_PRESS events from the trough would be handled only if
    the timer had stopped running. First, however, I have to find a way to
    discover whether I'm dealing with an event from the slider or the trough.

    ================== Possible solutions ======================
    1. Make the private struct FL_SCROLLBAR_SPEC visible to the outside world.
    Is there a reason why these private structs aren't visible already (so that
    we can define prehandler/callback functions for them)?

    I guess that one short term solution is to cheat and replicate that struct in
    my own code, but that's nasty and hardly robust. It will work for now though
    if I insist on the use of xforms 1.0.

    2. Keep the private structs hidden but provide the ability to define
    client-side prehandler and callback routines for the hidden FL_OBJECTS.

    3. I've had some tentative ideas about using the mouse position, together
    with the (known) size and position of the slider to extract this information.
    However, this is clearly not going to work very well (because I can only
    guess the outer bounds of the up, down buttons).

    4. Is there an easy way I don't know about?

    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 : Mon Dec 02 2002 - 13:31:27 EST