Fanning Software Consulting

Draw Widget Press and Release Values Undocumented

QUESTION: When I press/release the left/middle/right button in a draw widget in IDL 6.2 running on Linux, I get the usual:

           press/release value
   left              1
   middle            2
   right             4

Now, I have one of those mice where the middle "button" is also a wheel. Being a fat-fingered type, sometimes when I press the middle button in my application, I sometimes also move the wheel up or down. For those cases the event press/release values are:

            press/release value
   roll up            8
   roll down         16

However, the event.type values are still 0 or 1 (for mouse button press and release) even though I'm not depressing the wheel/button (that is, event.clicks always remains 0). The Wheel_Events keyword to WIDGET_DRAW is not set (and it's ignored for non-windows machines anyway).

Is this behavior documented anywhere? Is this just a poor mans method of emulating wheel events for non-windows systems?

ANSWER: No, this...well, let's call it a not documented anywhere. It is not even clear what it is. It appeared first in IDL 6.2 (apparently) and was there in IDL 6.3, and seems to have disappeared again in IDL 6.4.

Paul van Delst reports that he uses the following program to get around the problem:

   FUNCTION WPLOT_Which_Button, value
      CASE value OF
         1:   e='LEFT'
         2:   e='MIDDLE'
         4:   e='RIGHT'
         8:   e='UP'
        16:   e='DOWN'
        ELSE: e='NONE'
      RETURN, e

The function is called like this:

   IF ( WPLOT_Which_Button(event.RELEASE) EQ 'LEFT' ) THEN ...

Web Coyote's Guide to IDL Programming