[comp.windows.x.motif] How do you get xmArrowButton widgets to repeat?

mps@sparc14.hri.com (Mark Stockley) (05/18/91)

I have several xmArrowButtonWidgetClass widgets that I use to scroll thru a
window. This works fine, but I have to press and release the mouse button 
each time I wish to scroll down an entry. I would like to be able to HOLD
the button down and have the window scroll UNTIL I RELEASE the arrow.

Any ideas?

Thanks in advance,
    Mark

------------------------------------------------------------------------------
Mark P. Stockley    |   INET: mps@hri.com    | But I don't like Spam!!!
Horizon Research    |  Voice: (617) 466-8300 | 
1432 Main St.,      |   		     | Is the alphabet in that order
Waltham MA 02154    |    FAX: (617) 466-8323 | or is it because of that song?
------------------------------------------------------------------------------

al@osf.org (Alastair Gourlay) (05/20/91)

> I have several xmArrowButtonWidgetClass widgets that I use to scroll thru a
> window. This works fine, but I have to press and release the mouse button 
> each time I wish to scroll down an entry. I would like to be able to HOLD
> the button down and have the window scroll UNTIL I RELEASE the arrow.


You might try the following (untested) code segment:

/***********/

static XtIntervalId timer;

ArrowButton XmNarmCallback:

    arm_cb(w,cd,cb)
        Widget w;
        XtPointer cd, cb;
    {
        timer = XtAppAddTimeOut(app, SCROLL_INTERVAL, timer_proc, w)
    }

ArrowButton XmNdisarmCallback:

    disarm_cb(w,cd,cb)
        Widget w;
        XtPointer cd, cb;
    {
        XtRemoveTimeOut(t);
    }

Scrolling code:

    timer_proc(w, t)
        Widget w;
        XtIntervalId t;
    {
        /* do scrolling for ArrowButton w */

        timer = XtAppAddTimeOut(app, SCROLL_INTERVAL, timer_proc, w)
    }

This should work :-)  ..although you may want to put in an initial delay before
the auto-scrolling starts.

If you are opening multiple display connections, you should remove the global
XtIntervalId, and keep track of it in the Arrowbutton XmNuserData resource.)


Alastair Gourlay.

beau1029@mstr.hgc.edu (donald beaudry) (05/20/91)

In article <1991May17.202328.11709@hri.com> mps@hri.com writes:
>I have several xmArrowButtonWidgetClass widgets that I use to scroll thru a
>window. This works fine, but I have to press and release the mouse button 
>each time I wish to scroll down an entry. I would like to be able to HOLD
>the button down and have the window scroll UNTIL I RELEASE the arrow.
>
This behavior exist in the XmScrollBar widget.  If you have access to
ScrollBar.c, you are all set.