UI objects other than rectangular and transparency issues

May 18, 2011 at 3:24pm

UI objects other than rectangular and transparency issues

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 ?

Thanks.

- Luigi

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

[attachment=162560,2260]

Attachments:
  1. circularobjectexamplelocked.png
#57197
May 21, 2011 at 5:19pm

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. –
#204881
May 22, 2011 at 6:56pm

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. –
Attachments:
  1. Untitled1.maxpat
#204882
May 23, 2011 at 5:05am

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…

#204883
May 25, 2011 at 3:25pm

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;
}

best,
Tim

#204884
May 26, 2011 at 5:19am

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

Best

- Luigi

#204885

You must be logged in to reply to this topic.