[PD] Data structures and their clickable area

Jonathan Wilkes jancsika at yahoo.com
Tue Jan 28 03:34:42 CET 2014


On 01/27/2014 05:35 PM, Roman Haefeli wrote:
> Hi
>
> I'm using a template consisting of a rectangle done with [filledpolygon]
> and a number [drawnumber] in it. While mouse clicks anywhere in the area
> of the rectangle are detected, it's only possible to change the number
> with the keyboard when I exactly click on the number. Is there a way to
> make the number catch the keyboard no matter where I click in the
> rectangle?

That's not possible.  Essentially what you want is to take a click from 
one draw command-- [filledpolygon]-- and "map" it or forward it to 
another-- [drawnumber].  Scalars don't give you any tools to hook in to 
a parent drawing command's widgetbehavior that way.

>   Similarly, I'd like to be able to mouse-drag anywhere in the
> rectangle in order to change the value of the number.

You could probably do it if you use a field variable to define hotspots 
on every 6x6 tile of the rectangle.  But you'd also have to constrain 
movement of the rectangle by abusing the quanta syntax, something like 
(-whatever:whatever)(0:0).  That would presumably constrain the field 
variable's screen coordinates so that it doesn't move when you 
click-drag it.  Then use the same field variable for your [drawnumber].

I'm almost finished with some new drawing instructions for data 
structures in Pd-l2ork that implement a subset of the svg spec. I've got 
some mouseover/mouseout widgetbehaviors working, but still nothing 
particularly sophisticated in terms of mapping mouse/keyboard 
interaction to field variables.

One possibility is to make the hotspot bbox settable.  Or maybe have a 
method to forward widgetbehaviors to another drawing command.

-Jonathan

>
> Any ideas?
>
> Roman
>
>
>
> _______________________________________________
> Pd-list at iem.at mailing list
> UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list




More information about the Pd-list mailing list