comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » middle mouse button emulation in widget_draw
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
middle mouse button emulation in widget_draw [message #45979] Fri, 21 October 2005 11:35 Go to next message
Benjamin Hornberger is currently offline  Benjamin Hornberger
Messages: 258
Registered: March 2004
Senior Member
Hi all,

I was wondering if anybody has dealt with the following: In the IDL help
for widget_draw, "Note on Middle Mouse Button Emulation", it sais:

When a user holds down the Control key and presses the left mouse button
within a draw widget, IDL emulates a middle mouse button press. This
means that the event structure generated will have the PRESS field set
to 2 (middle button) and the MODIFIERS field set to 0 (no modifier). IDL
will never generate an event with PRESS set to 1 (left button) and
MODIFIERS set to 2 (control).

But (see test_draw.pro at the end of the message):

IDL Version 6.2, Microsoft Windows (Win32 x86 m32). (c) 2005, Research
Systems, Inc.
IDL> .compile test_draw
IDL> test_draw
;; Ctrl + Left-Click in draw widget
** Structure WIDGET_DRAW, 12 tags, length=44, data length=37:
ID LONG 564
TOP LONG 563
HANDLER LONG 564
TYPE INT 0
X LONG 59
Y LONG 20
PRESS BYTE 1
RELEASE BYTE 0
CLICKS LONG 1
MODIFIERS LONG 2
CH BYTE 0
KEY LONG 0
** Structure WIDGET_DRAW, 12 tags, length=44, data length=37:
ID LONG 564
TOP LONG 563
HANDLER LONG 564
TYPE INT 1
X LONG 59
Y LONG 20
PRESS BYTE 0
RELEASE BYTE 1
CLICKS LONG 1
MODIFIERS LONG 2
CH BYTE 0
KEY LONG 0



Same on IDL Version 6.2 (linux x86 m32), by the way.

So I guess it's safe to check for PRESS = 1 and MODIFIERS = 2, or does
anybody have other experiences? Any comments?

Thanks,
Benjamin


;;---------------------------------------------------------- ----
PRO test_draw_event, event

help, event, /str

END

PRO test_draw

tlb = widget_base()
draw = widget_draw(tlb, xs=100, ys=100, /button_events, $
event_PRO='test_draw_event')

widget_control, tlb, /realize

xmanager, 'draw', tlb, /no_block

END
Re: middle mouse button emulation in widget_draw [message #46134 is a reply to message #45979] Mon, 31 October 2005 08:18 Go to previous message
Alan Youngblood is currently offline  Alan Youngblood
Messages: 1
Registered: October 2005
Junior Member
Benjamin,

The middle mouse button emulation was removed from Widget_Draw events for
IDL 6.2. This allows the application handling the left-ctrl events to
implement whatever behavior is desired, middle mouse button emulation or
some other use of the ctrl key. Here is the applicable item from the IDL 6.2
release notes:

27938: Three-Button-Mouse Emulation Removed from Draw Widget

In previous versions of IDL, left-clicking with the mouse in a draw widget
(either direct or object graphics) while holding down the Ctrl key was
reported as a middle-mouse-button click event. This emulation has been
removed, and left-clicking with Ctrl generates a left-click event with the
correct control modifier. Please be advised of this change if you have code
using the prior three-button emulation.

Unfortunately the "Note on Middle Mouse Button Emulation" in the section on
Widget_Draw events was not removed until after the release of IDL 6.2.

Rick Towler's advice to check !version.release is definitely a good idea so
that you can test for the control modifier in 6.2 or later releases of IDL.

Regards,

Alan


--

"Benjamin Hornberger" <benjamin.hornberger@stonybrook.edu> wrote in message
news:4359350c$1_1@marge.ic.sunysb.edu...
> Hi all,
>
> I was wondering if anybody has dealt with the following: In the IDL help
> for widget_draw, "Note on Middle Mouse Button Emulation", it sais:
>
> When a user holds down the Control key and presses the left mouse button
> within a draw widget, IDL emulates a middle mouse button press. This
> means that the event structure generated will have the PRESS field set
> to 2 (middle button) and the MODIFIERS field set to 0 (no modifier). IDL
> will never generate an event with PRESS set to 1 (left button) and
> MODIFIERS set to 2 (control).
>
> But (see test_draw.pro at the end of the message):
>
> IDL Version 6.2, Microsoft Windows (Win32 x86 m32). (c) 2005, Research
> Systems, Inc.
> IDL> .compile test_draw
> IDL> test_draw
> ;; Ctrl + Left-Click in draw widget
> ** Structure WIDGET_DRAW, 12 tags, length=44, data length=37:
> ID LONG 564
> TOP LONG 563
> HANDLER LONG 564
> TYPE INT 0
> X LONG 59
> Y LONG 20
> PRESS BYTE 1
> RELEASE BYTE 0
> CLICKS LONG 1
> MODIFIERS LONG 2
> CH BYTE 0
> KEY LONG 0
> ** Structure WIDGET_DRAW, 12 tags, length=44, data length=37:
> ID LONG 564
> TOP LONG 563
> HANDLER LONG 564
> TYPE INT 1
> X LONG 59
> Y LONG 20
> PRESS BYTE 0
> RELEASE BYTE 1
> CLICKS LONG 1
> MODIFIERS LONG 2
> CH BYTE 0
> KEY LONG 0
>
>
>
> Same on IDL Version 6.2 (linux x86 m32), by the way.
>
> So I guess it's safe to check for PRESS = 1 and MODIFIERS = 2, or does
> anybody have other experiences? Any comments?
>
> Thanks,
> Benjamin
>
>
> ;;---------------------------------------------------------- ----
> PRO test_draw_event, event
>
> help, event, /str
>
> END
>
> PRO test_draw
>
> tlb = widget_base()
> draw = widget_draw(tlb, xs=100, ys=100, /button_events, $
> event_PRO='test_draw_event')
>
> widget_control, tlb, /realize
>
> xmanager, 'draw', tlb, /no_block
>
> END
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: problem:symbol not be showed in IdlgrPlot object etc.
Next Topic: rebinning histogram

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Fri Oct 10 14:42:51 PDT 2025

Total time taken to generate the page: 1.03824 seconds