WwMultiClickHandler Function
Adds or removes a multi-click event handler.
Usage
status = WwMultiClickHandler(wid, handler[, userdata])
Input Parameters
wid — The widget ID of the widget to which the multi-click handler is added or from which it is removed.
handler — The name of the multi-click handler procedure.
userdata — (optional) Stores the value of the specified variable.
Returned Value
status — A value indicating the success or failure of the addition or removal of the multi-click event handler.
*1 — Indicates success.
*0 — Indicates failure.
Keywords
Add — Add the specified multi-click handler for the ButtonPress event.
Clicks — Number of clicks required before the event handler is called. (Default: 2)
Remove — Remove the specified multi-click handler from the widget.
TimeInterval — Maximum time interval, in milliseconds, between multiple clicks that determines whether consecutive clicks are interpreted as multiple clicks.
Event Handler Parameters
The following parameters are required for the multi-click event handler procedure:
wid — The ID of the widget from which the multi-click event handler is called.
userdata — User-defined data.
event — An opaque event handle used in subsequent calls to request event data.
Discussion
WwMultiClickHandler allows an application to handle multiple mouse clicks (two, three, or more) when they are received in the given time interval.
WwMultiClickHandler is a special type of event handler that only handles mouse-button clicks. The mask ButtonPressMask is set internally and does not have to be set by the user as in the case of a generic event handler such as WwHandler.
Example
This example creates a drawing area and displays an image. The event handler DrawMClickHandler is activated when a mouse click occurs in the drawing area. The callback DrawCB displays an image in the drawing area.
Enter the event handler and callback procedures into a file, and compile it with the .RUN command. Then, enter the widget commands at the WAVE> prompt.
To dismiss the drawing area, select the appropriate function (such as Close) from the window manager menu.
Event Handler and Callback Procedures
This event handler takes action when a button is pressed while the pointer is in the drawing area.
PRO DrawMClickHandler, wid, shell, event
   COMMON draw, top, img
   ; Print the position of the button press.
   PRINT, WwGetPosition(event)
   ; Print the button.
   PRINT, WwGetButton(event,State = state)
   ; Print the state of the modifier keys.
   PRINT, 'State:', state
   ; Remove the handler.
   status = WwMultiClickHandler(wid, 'DrawHandler', /Remove)
END
 
PRO DrawCB, wid, data
   ; This callback displays the image.
   COMMON draw, top, img
   TV, img
END
Widget Commands
COMMON draw, top, img
top=WwInit('ww_ex200', 'Examples', layout)
LOADCT, 5, /Silent
img=BYTARR(512,512)
OPENR,1, !Data_Dir + 'head.img' 
READU,1,img
CLOSE, 1
draw=WwDrawing(layout, 1,'DrawCB', $
   [256,256], [512,512], Area = darea)
; Register the multi-click (double-click in this case) handler.
status = WwMultiClickHandler(darea, 'DrawMClickHandler', top)
status=WwSetValue(top, /Display)
WwLoop
See Also