|
Re: Bug with object graphics, app_scroll and the mouse in 6.1 under Windows. [message #40655 is a reply to message #40654] |
Wed, 25 August 2004 10:11  |
dcw_yip
Messages: 22 Registered: October 2003
|
Junior Member |
|
|
I can't do the second solution since my images tend to be fairly large
and regular scrolling just won't do.
But the insight by the previous poster about the key presses vs
releases and your first solution is a good work around. It's a little
bit more complicated since you have to take into account double clicks
since they are ok. But here's the modified bug.pro that works
properly now. It would still be nice if RSI could fix this at some
point.
David
--------------- program -----------------
pro bug_event, event
if !version.release eq '6.1' and $
!version.os_family eq 'Windows' and $
event.type eq 0 and event.clicks ne 2 then event.y -= 600
print, event.x, event.y
end
pro bug
base = widget_base(title='bug')
draw = WIDGET_DRAW(base, /button_events, /app_scroll,
graphics_level=2)
widget_control, draw, xsize=600, ysize=600, draw_xsize=1200,
draw_ysize=1200
widget_control, base, /realize
xmanager, 'bug', base
end
David Fanning <davidf@dfanning.com> wrote in message news:<MPG.1b956d2c35ad426a989851@news.frii.com>...
> Well, I don't want to point out the obvious here, but
> two ways around it occur immediately: (1) just subtract
> the amount of the window hidden by the scroll bars from
> the Y value on button press events, and (2) use regular
> scroll windows rather than app_scroll windows.
>
> (1)
>
> IF !Version.Release EQ '6.1' AND $
> !Version.OS_Family EQ 'Windows' THEN $
> IF event.type EQ 1 THEN y = event.y - 600 ELSE y = event.y
>
> (2)
> draw = Widget_Draw(base, /Button_events, /Scroll, $
> XSize=1200, YSize=1200, X_Scroll_Size=600, Y_Scroll_Size=600, $
> Graphics_Level=2)
>
> Cheers,
>
> David
|
|
|
Re: Bug with object graphics, app_scroll and the mouse in 6.1 under Windows. [message #40658 is a reply to message #40655] |
Wed, 25 August 2004 09:52  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
David Yip writes:
> That does help. I hadn't notice that the value was different during
> presses as opposed to releases. I tend to click really quickly and as
> you can see from my output, the good and bad values weren't 1 for 1.
> But following your posting, by clicking slowly it does appear the bad
> values are the presses and the good values are the releases. I should
> be able to work with that.
And if your event handler is not currently aware
of the difference between a button press and a
button release, you might want to fix that, too.
It will make your event handler twice as fast since
you will only execute it once and not twice. :-)
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
|
|
|
Re: Bug with object graphics, app_scroll and the mouse in 6.1 under Windows. [message #40659 is a reply to message #40658] |
Wed, 25 August 2004 09:35  |
dcw_yip
Messages: 22 Registered: October 2003
|
Junior Member |
|
|
Haje:
That does help. I hadn't notice that the value was different during
presses as opposed to releases. I tend to click really quickly and as
you can see from my output, the good and bad values weren't 1 for 1.
But following your posting, by clicking slowly it does appear the bad
values are the presses and the good values are the releases. I should
be able to work with that.
thanks,
David
"Haje Korth" <noemail@address.com> wrote in message news:<cggbsd$7mb$1@aplcore.jhuapl.edu>...
> I gave your code a quick try. I get different values for pressing and
> releasing. Does this help?
>
> Cheers,
> Haje
>
>
|
|
|
Re: Bug with object graphics, app_scroll and the mouse in 6.1 under Windows. [message #40684 is a reply to message #40659] |
Tue, 24 August 2004 15:20  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
David Yip writes:
> So I upgraded to IDL 6.1. Now my program doesn't handle mouse events
> properly. I tracked it down and it seems that there's a bug with IDL
> 6.1 under Windows if you have a draw widget with app_scroll and object
> graphics enabled. The symptom is that the y coordinate of the mouse
> event oscillates between the correct value and the correct value plus
> the scroll range. So say the ysize of the widget is 600 and the
> draw_ysize is 800. When you click in the widget so that you're on y
> of 363, it oscillates between 363 and 563 even though you are clicking
> on the same spot over and over again. This didn't happen under 6.0 or
> 6.1 beta. This also doesn't happen on a Mac.
>
> I need both object graphics and scrolling. Is there a way around this
> or should we just drop back to 6.0?
Well, I don't want to point out the obvious here, but
two ways around it occur immediately: (1) just subtract
the amount of the window hidden by the scroll bars from
the Y value on button press events, and (2) use regular
scroll windows rather than app_scroll windows.
(1)
IF !Version.Release EQ '6.1' AND $
!Version.OS_Family EQ 'Windows' THEN $
IF event.type EQ 1 THEN y = event.y - 600 ELSE y = event.y
(2)
draw = Widget_Draw(base, /Button_events, /Scroll, $
XSize=1200, YSize=1200, X_Scroll_Size=600, Y_Scroll_Size=600, $
Graphics_Level=2)
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
|
|
|
Re: Bug with object graphics, app_scroll and the mouse in 6.1 under Windows. [message #40685 is a reply to message #40684] |
Tue, 24 August 2004 14:27  |
Haje Korth
Messages: 651 Registered: May 1997
|
Senior Member |
|
|
I gave your code a quick try. I get different values for pressing and
releasing. Does this help?
Cheers,
Haje
"David Yip" <dcw_yip@yahoo.com> wrote in message
news:201431cc.0408241116.76603294@posting.google.com...
> So I upgraded to IDL 6.1. Now my program doesn't handle mouse events
> properly. I tracked it down and it seems that there's a bug with IDL
> 6.1 under Windows if you have a draw widget with app_scroll and object
> graphics enabled. The symptom is that the y coordinate of the mouse
> event oscillates between the correct value and the correct value plus
> the scroll range. So say the ysize of the widget is 600 and the
> draw_ysize is 800. When you click in the widget so that you're on y
> of 363, it oscillates between 363 and 563 even though you are clicking
> on the same spot over and over again. This didn't happen under 6.0 or
> 6.1 beta. This also doesn't happen on a Mac.
>
> I need both object graphics and scrolling. Is there a way around this
> or should we just drop back to 6.0?
>
> David
>
>
> Here's a program and output that demonstrates this:
>
> ---------------------- program -----------------------
>
> pro bug_event, event
> print, event.x, event.y
> end
>
> pro bug
> base = widget_base(title='bug')
> draw = WIDGET_DRAW(base, /button_events, /app_scroll, $
> graphics_level=2)
> widget_control, draw, xsize=600, ysize=600, draw_xsize=1200, $
> draw_ysize=1200
> widget_control, base, /realize
>
> xmanager, 'bug', base
> end
>
> ----------------------- output -----------------------
>
> 404 363
> 404 563 <-- wrong value
> 404 363
> 404 364
> 404 363
> 404 563 <-- wrong value
> 404 363
|
|
|