Page 1 of 1

Labeling (String Concat) Arrays - SOLVED!!!

Posted: 28 Jul 2014 12:44
by Joe Soap
Hey guys - little problem that's driving me nuts.

Constructing an object with a while loop, and having problems figuring out the correct syntax to iterate setting the labels against the array.

I know / remember someone posted this a while back but for the life of me I can't find it anywhere - nor can I seem to work it out from first principles . . . suspect my aching brain has been working on the thing too damn long to grok anything at all right now,

Some combination of a for loop within the while loop? I know it's that I'm not setting up an index . . . at least I think it is. Dammit.

[edit]

ie: I have an array of labels with 16 entries and I want to spray these across the 16 member-objects captured by the while loop - but all I'm getting is the first entry of the labels sprayed accross the entire object array. Using while loop so i can add to or subtract objects without crashing - portable y'see!




halp!!!????

Re: Labeling Arrays (String Concat)

Posted: 28 Jul 2014 14:09
by Softcore
Can you post an example of your code as it is?

Re: Labeling Arrays (String Concat)

Posted: 28 Jul 2014 14:27
by Joe Soap
Hey dude!

Here's the relevant bit:

decl name = 'sel_1';
decl obj = findchild(presets2,name);
decl i;
while(obj)
{

setattribute(obj,'labels',{'1','2','3','4','5','6','7','8','9','10','11','12','13','14','15','16'});
obj = getnext(obj);
i++;
}

. . . broken just broken! How to assign and iterate the labels array to the object array?

Re: Labeling Arrays (String Concat)

Posted: 07 Aug 2014 09:56
by Softcore
Is the "multilabel" attribute enabled?

Works here!

Re: Labeling Arrays (String Concat)

Posted: 07 Aug 2014 09:58
by Softcore
Also......

Re: Labeling Arrays (String Concat)

Posted: 07 Aug 2014 10:34
by Joe Soap
Oh hey man, I got that resolved - then ran into other problems . . . tore hair out, lost sleep etc. Resolved those.

You know how it goes! :D

And in the end? I'm probably gonna go a different way - but three weeks wrestling with an assortment of assignment order, loop structure and plain old just not understanding WTF I was looking at (fully, or at all in some cases) issues, time well spent.

Hopefully it sinks in.

Re: Labeling Arrays (String Concat)

Posted: 07 Aug 2014 20:27
by Joe Soap
Just looked at those out of curiosity - neither of the solutions provided actually address the problem as specified, which was to label 16 separate SINGLE pads objects as if they were one 16*1 (or 8*2 or 4*4) Pads object.

Solution courtesy of Antonio Blanca.

Re: Labeling (String Concat) Arrays - SOLVED!!!

Posted: 08 Aug 2014 15:04
by Softcore
I somehow missed the "single pads" detail lol. Sorry for that!

Re: Labeling (String Concat) Arrays - SOLVED!!!

Posted: 08 Aug 2014 21:28
by Joe Soap
No worries dude - it's my English I'm sure! ;)

Cheers for taking the time to help innit :).