Skip Menu |

This queue is for tickets about the Prima CPAN distribution.

Report information
The Basics
Id: 77546
Status: resolved
Priority: 0/
Queue: Prima

People
Owner: Nobody in particular
Requestors: user42 [...] zip.com.au
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: widget MouseWheel scale docs
Date: Thu, 31 May 2012 08:41:14 +1000
To: bug-Prima [...] rt.cpan.org
From: Kevin Ryde <user42 [...] zip.com.au>
In the Prima::Widget docs of the MouseWheel event, the bit about "Z" being +/-120, or a multiple of that, or whatever, could helpfully be a bit more definite about what a program should expect there or how the value should be used. I wondered if a program should only look for positive or negative, or if it should move by "Z/120" many units -- for whatever a unit means in a particular widget. I see Prima::ColorDialog does something like the latter. Tk has the same 120, or WxWidgets has a "rotation scale" amount you query. I'd suppose a fixed 120 might be good enough if all target platforms can be made to behave that way.
The event with 120- base comes from win32 as a WM_MOUSEWHEEL event - the OS does it itself, Prima has no say here. In x11 Prima emulates the wheel event by interpreting a ButtonPress event as a wheel rotation, and there's no central entity in X11 where it can consult about the value of 120. On the practical side, every toolkit just does the 120 multiplication, so I don't know really what should be done here. If you can think of a patch to the docs I'll apply.
Subject: Re: [rt.cpan.org #77546] widget MouseWheel scale docs
Date: Sun, 10 Jun 2012 09:58:10 +1000
To: bug-Prima [...] rt.cpan.org
From: Kevin Ryde <user42 [...] zip.com.au>
"KARASIK via RT" <bug-Prima@rt.cpan.org> writes: Show quoted text
> > If you can think of a patch to the docs I'll apply.
Perhaps something like below. I like "INCR" or "STEP" or something for the parameter name. "Z" suggested 3-D coordinates on first reading, which of course is not what the wheel does.
diff --git a/pod/Prima/Widget.pod b/pod/Prima/Widget.pod index 944eedb..8c6826d 100644 --- a/pod/Prima/Widget.pod +++ b/pod/Prima/Widget.pod @@ -753,7 +753,7 @@ The first set deals with button actions. Pressing, de-pressing, clicking notifications. The notifications are sent together with the mouse pointer coordinates, the button that was touched, and the eventual modifier keys that were pressed. In addition, C<MouseClick> provides the boolean flag if the click was single or double, -and C<MouseWheel> - the Z-range of the wheel turn. These notifications occur +and C<MouseWheel> the wheel turn amount. These notifications occur when the mouse event occurs within the geometrical bounds of a widget, with one notable exception, when a widget is in I<capture> mode. If the C<::capture> is set to 1, then these events are sent to the widget even @@ -2684,14 +2684,22 @@ X and Y are the mouse pointer coordinates. See also: C<MouseDown>, C<MouseClick>, C<MouseWheel>, C<MouseMove>, C<MouseEnter>, C<MouseLeave> -=item MouseWheel MOD, X, Y, Z +=item MouseWheel MOD, X, Y, INCR Occurs when the user rotates mouse wheel on a widget. MOD is a combination of C<km::XXX> constants, reflecting the pressed modificator keys during the event, -X and Y are the mouse pointer coordinates. Z is the virtual -coordinate of a wheel. Typical ( 2001 A.D. ) mouse produces -Z 120-fold values. +X and Y are the mouse pointer coordinates. + +INCR is the wheel movement, scaled by 120. +120 is a step upwards, or +-120 downwards. For wheels which are discrete button clicks INCR is ++/-120 but other devices may give other amounts. A widget should +scroll by INCR/120 many units, or partial unit, for whatever its unit +of movement might be, such as lines of text, slider ticks, etc. + +A widget might like to vary its unit move according to the MOD keys. +For example C<Prima::SpinEdit> has a C<step> and C<pageStep> and moves +by C<pageStep> when C<km::Ctrl> is held down (see L<Prima::Sliders>). See also: C<MouseDown>, C<MouseUp>, C<MouseClick>, C<MouseMove>, C<MouseEnter>, C<MouseLeave>
-- Food jargon elucidated for the layman: "Gourmet selection" -- twice the price.
committed, thank you!