UI objects other than rectangular and transparency issues

Luigi Castelli's icon

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.

2261.circularobjectexamplelocked.png
png
spectro's icon
Max Patch
Copy patch and select New From Clipboard in Max.

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.

Luigi Castelli's icon

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.

Max Patch
Copy patch and select New From Clipboard in Max.

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.

2283.Untitled1.maxpat
Max Patch
spectro's icon

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...

Timothy Place's icon

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

Luigi Castelli's icon

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

Best

- Luigi