Re: Generating events while a button is pressed [message #6234] |
Wed, 15 May 1996 00:00 |
David Foster
Messages: 341 Registered: January 1996
|
Senior Member |
|
|
Phil Williams <williams@irc.chmcc.org> wrote:
>
> I hope someone out there can give me a hand with this one.
>
> I want to have a widget_button that generates events while the button
> remains pressed (sorta like the action of DRAG on a widget_slider) so
> that I can scroll through a stack of data, say.
>
I wrote a program to allow the user to display a series of
images in a window, one at a time, and scroll through them forward
and back. It's meant for MR medical images, so send me an email
if you'd like a copy ... it's written for a UNIX system, but it'd
be pretty easy to modify.
Basically what I did was to use little draw widgets as the "scroll
buttons". I put text in the draws to identify them. When you do
this (using /BUTTON_EVENTS of course, and set the�UVALUE of the
draw widgets to identify the events) you can use
cursor, x, y, /nowait, /device
if ( x eq -1 or !err eq 0 ) then begin
print, 'Button released'
return, 0
endif
This also lets you use all three mouse buttons, if you want to have
multiple scroll modes (by one, by page, etc).
Hope this helps.
Dave Foster
UCSD Brain Image Analysis Lab
foster@bial1.ucsd.edu
|
|
|
Re: Generating events while a button is pressed [message #6245 is a reply to message #6234] |
Tue, 14 May 1996 00:00  |
rivers
Messages: 228 Registered: March 1991
|
Senior Member |
|
|
In article <DrCKAz.B65@midway.uchicago.edu>, rivers@cars3.uchicago.edu (Mark Rivers) writes:
> In article <31973A26.167E@irc.chmcc.org>, Phil Williams <williams@irc.chmcc.org> writes:
>> I hope someone out there can give me a hand with this one.
>>
>> I want to have a widget_button that generates events while the button
>> remains pressed (sorta like the action of DRAG on a widget_slider) so
>> that I can scroll through a stack of data, say.
>
> I can think of one way to do it:
>
> 1) Detect button press event, program enters "scroll mode"
> 2) Set a timer widget for a fraction of a second. On every timer widget
> event do your "scroll" action, and set the timer widget again.
> 3) On button release event, cancel timer event and exit "scroll mode".
My response above was incorrect, because normal buttons can only generate
button press events, not release events. Exclusive or non-exclusive buttons
can generate both press and release, but the "release" requires a second mouse
click, so this is not what Phil wanted.
I did manage to achieve what Phil wants to do using small draw widgets, rather
than button widgets. Draw widgets can detect both press and release events.
____________________________________________________________
Mark Rivers (312) 702-2279 (office)
CARS (312) 702-9951 (secretary)
Univ. of Chicago (312) 702-5454 (FAX)
5640 S. Ellis Ave. (708) 922-0499 (home)
Chicago, IL 60637 rivers@cars3.uchicago.edu (Internet)
|
|
|
Re: Generating events while a button is pressed [message #6248 is a reply to message #6245] |
Mon, 13 May 1996 00:00  |
rivers
Messages: 228 Registered: March 1991
|
Senior Member |
|
|
In article <31973A26.167E@irc.chmcc.org>, Phil Williams <williams@irc.chmcc.org> writes:
> I hope someone out there can give me a hand with this one.
>
> I want to have a widget_button that generates events while the button
> remains pressed (sorta like the action of DRAG on a widget_slider) so
> that I can scroll through a stack of data, say.
I can think of one way to do it:
1) Detect button press event, program enters "scroll mode"
2) Set a timer widget for a fraction of a second. On every timer widget
event do your "scroll" action, and set the timer widget again.
3) On button release event, cancel timer event and exit "scroll mode".
____________________________________________________________
Mark Rivers (312) 702-2279 (office)
CARS (312) 702-9951 (secretary)
Univ. of Chicago (312) 702-5454 (FAX)
5640 S. Ellis Ave. (708) 922-0499 (home)
Chicago, IL 60637 rivers@cars3.uchicago.edu (Internet)
|
|
|