Forums > MaxMSP

ubutton advice

April 10, 2007 | 11:17 pm

Hello all

I’m making a patch that utilises the ubutton object

Basically I’m using the mousestate object to set the frequency of an oscillator, I’ve chosen to use the area inside the ubutton as the pitch (horizontal value) and amplitude (vertical value) of the oscillator.

When the mouse is clicked down a gate opens passing each value to a few if statements that determine whether the values passed are within the are of the ubutton.

My problem is that as soon as i move the patch all my processing becomes void as the ubuttons horizontal and vertical values have changed.

I’m wondering if there’s any way round this e.g. fixing the values of a window even if its moved around?

Thanks

Mike


April 12, 2007 | 1:16 am

Quote: Mike S wrote on Tue, 10 April 2007 16:17
—————————————————-
> When the mouse is clicked down a gate opens passing each value to a few if statements that determine whether the values passed are within the are of the ubutton.

> I’m wondering if there’s any way round this e.g. fixing the values of a window even if its moved around?
—————————————————-

The ubutton already outputs the X/Y coordinates of a mouse click inside of it via its 3rd outlet. Why not just use that? You can also change whether mousestate’s coordinates are relative to the whole screen or just to the patcher mousestate is in by sending it the messages "mode 0" and "mode 1" respectively. Look at the "p coordinates" sub-patch in the help file.


April 14, 2007 | 12:18 pm

I didn’t know that, thanks alot


Viewing 3 posts - 1 through 3 (of 3 total)