Page 1 of 1

what does "findobject()" do

Posted: 30 Sep 2013 15:51
by electrofux
The manual says the findobject(name) function "selects an Object within a tree structure (project,interface or container)".

What does that mean, what can you do with a found and selected object?

Same goes for getnext(object).

Re: what does "findobject()" do

Posted: 01 Oct 2013 09:49
by electrofux
Can i access the via the getnext function selected objects functions and variables? And how is the syntax then?

Re: what does "findobject()" do

Posted: 02 Oct 2013 05:02
by Macciza
Hi
There are a few different examples of there use in the manual . . .
And I guess a few different ways of using them as well . . .

One basic option is iteration - doing something with a whole bunch of objects . . .
See the 'while' loop example in the manual for one use case . . .
You can also setup arrays of object names and step through it in a 'for' loop finding each object doing something and then again for the next 'i' in the list

decl target = {'something','something','etc'};
decl n = sizeof(target);
decl obj;
decl i;
for(i = 0; i < n; i++){
obj = findobject(target);
setattribute(obj,'color',RGB(1,0,0));
}

Or if you have a bunch of Faders in a Container you could find the container getfirst fader then getnext each following obj . . .

Keep your eye out for there use in others code - and see how they are using it
Hope that helps
MM

Re: what does "findobject()" do

Posted: 02 Oct 2013 11:50
by electrofux
Woot, it works like i was hoping. I can use the setexpression function to trigger an object that i can only reference by name.

I had a hard time accessing the different 64 Pads of the Pushscale template because they were not in an array. But now i can make an array of the Padnames and then count through.

Incoming selectable Chords for that template :D

Thx