Forums > Dev

UI objects other than rectangular and transparency issues

May 18 2011 | 3:24 pm

Hi there,

I was writing a circular UI object and I encountered a problem when overlapping it with other objects in Max.

The scenario is basically the following:
the circular object is resized and made pretty large. Another standard UI object lies in the background (for example let's say a dial object) and my circular object is on top of it. The dial object is exactly under one of the corners of the circular object box. Now, being a circular object, the area in proximity of the box corners is completely transparent and it is supposed to let any user action through (such as a mouse click). However even if it doesn't "physically" cover the dial object my circular object does intercept every user action (clicking, dragging, etc…) with the consequence that I am not able to click on the dial.

This does not happen among standard Max/MSP UI objects which always behave in the expected way.

So, what am I missing here ?


– Luigi

I have attached a picture to help better understand the issue.


  1. circularobjectexamplelocked.png


May 21 2011 | 5:19 pm

It does not appear to be the case in Max (at least with the example below) that transparent areas of an enlarged UI object will allow user input to pass through to smaller underlying objects. The solution is to arrange smaller objects such that they lie "above" larger ones.

-- Pasted Max Patch, click to expand. --

May 22 2011 | 6:56 pm

Thanks for your reply, Spectro.

Well, the dial object cannot really considered a circular object and just setting the alpha channel to 0.0 won’t work because the real boundaries of the object remain rectangular.

I was more referring to object that are or could be made circular (or almost circular) such as the textbutton object for example. Check out the attached patch.

-- Pasted Max Patch, click to expand. --

  1. Untitled1.maxpat
May 23 2011 | 5:05 am

I see what you are saying Luigi, and clearly should have tried more UI objects like the Text Button before posting a reply. With that said, It does seem strange as the text button’s outlets suggest a rectangular "background" while the active area is round(ed). Perhaps one of the Cycling74 team will be able to explain. Apologies for the noise…

May 25 2011 | 3:25 pm

It is possible. For example, bpatcher allows clicks to pass through. First, add a ‘hittest’ method:

class_addmethod(c, (method)myobj_hittest, "hittest", A_CANT, 0);

Then implement the method like this:

long myobj_hittest(t_myobj *x, t_object *patcherview, t_pt pt)
	long rv = 1;

	// Do something here and set rv = 0
	// if you want the click to pass through

	return rv;


May 26 2011 | 5:19 am

Once again, thank you so much Tim.
Works like a charm.


– Luigi

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

Forums > Dev