[PD-dev] local canvas-only pd_bind

Chris McCormick chris at mccormick.cx
Mon Mar 18 04:53:46 CET 2019


Hi,

On 17/3/19 11:38 pm, katja wrote:
> Mouseup is a bit of a maverick: you want to be alerted regardless of
> mouse position, i.e. any canvas or even outside Pd's territory.
> Otherwise one could easily get the equivalent of a dangling midinote.
> Therefore, would it be reasonable to conceive a dedicated class
> [mouseup], every instance of which would be informed about every
> mouseup event once?

Agree, and Jean-Yves suggestion on the other thread does this but from 
the Tk side which is not as useful as you need to have the user install 
a UI plugin to make it work. If a widget had mouse sensing like the one 
you describe elsewhere then you'd want it to universally receive mouseup.

> Anyhow, the other mouse events (mousedown, coordinates) are so much
> related to position that bundling these in a single class is useful,
> be it in a widget or otherwise.
Yep and I think you've had a lot of experience with my exact use-case 
here which is touchscreen-enabled Raspberry Pi.

My preferred design (please excuse me while I ungratefully conjure a 
bunch of work for someone):

  * Object just like cnv (hopefully just cnv).
  * Has a checkbox for "report mouse events".
  * When there is a mouse-down inside its rectangle it reports it with 
(x, y).
  * Once it has "grab" it outputs all mouse-move events with both (dx, 
dy) and also (x, y).
  * Once it has "grab" it catches the universal mouse-up event and 
reports it with (x, y).
  * (x, y) should be relative to the object's internal top-left 
position, so it can tell where the mouse is relative to itself.

The global receiver ideas are great and I am sure would be useful to 
others but for me personally at this time I can do that stuff with GUI 
plugins so it is less important.

 > Such a class could also be useful in connection
 > with existing Pd GUIs, for example to turn a single-cell radiobutton
 > into a momentary switch.

Exactly yes, with the [cnv] changes above you'd be able to build things 
like piano rolls, touch-pads, ribbon controllers, min-max selectors and 
probably many things we haven't thought of, as abstractions.

As you point out all of this would likely require modifying 
widgetbehaviour, unless mouse-up can be special-cased into one object 
like cnv.

Cheers,

Chris.

-- 
https://mccormick.cx/

Sign up to my newsletter to hear about tech I'm building.
https://mccormick.cx/subscribe





More information about the Pd-dev mailing list