Get scripting name of object at click location
I'm trying to find a way get the scripting name of any named object that I click on.
I'm not very good at javascript, but I tried to adapt Jeremy Bernstein's "pattrvoyant.js" (available at https://cycling74.com/forums/retrieve-patcher-heirarchy-from-pattr) to do this, but was unsuccessful. It actually worked as is, but only for objects in the frontmost patcher. In my case, my main patch contains a bpatcher with many named objects (panels, to be specific) inside, and I need to get the scripting name of the panel that is clicked on.
Is this possible?
Hello Anthony,
Maybe you can use hover + mousestate.
Ch.
Unfortunately, hover doesn't report Panels, it only works with objects that can actually do something when you click on them.
So either you need to add ubuttons on top of all your panels, or figure out a clever javascript way.
you're right... I completely forgot that
Thanks for pointing this out.
I don't think the javascript would need to be very "clever," per se, but I have never used javascript before, so it seems a bit daunting for me. I'm pretty sure all of the framework is there in pattrvoyant, I just can't figure out how to adapt it to work with bpatchers. If it isn't possible, I could use ubuttons (thanks for that idea), but it isn't ideal.
By the way, the link got messed up above, so here it is again:
could you substitute [textbuttons] for the panels? without any text, sized and colored to fit, just don't have them do anything when you hover or click on them. [hover] should work for those as long as ignoreclick is off.
Yeah, I could. I am just wary of potential CPU overhead, as there will be a dynamic number of them, possibly hundreds. That's why I was hoping to just use panels, as I imagine they are probably "simpler" than textbuttons or panel+ubutton. But that is a good solution too, better than me trying to tinker with Javascript, that's for sure.
A bit late, but just thought about that :
bpatchers works fine with hover!
So one could use an empty embedded bpatcher with background color for example.
Charles