Subscribe Bookmark RSS Feed

Using JSL, how to use Add Graphics Script with a variable number of items to add to a display?

jacaalgo

Community Trekker

Joined:

May 10, 2013

I need to add several graphic items of the same type to an existing display box, the problem is that I do not know in advance how many of these items I need to add. If I do not indicate the order in which I want the items added by not including the 'order' argument, and include the Add Graphics Script in a loop, only the last item in the loop shows in the display box. If I replace the 'order' argument for a variable, and evaluate the variable in the loop, I get an error message that the argument is invalid. Am I evaluating the argument incorrectly? I had tried Eval(Substitute(Expr...) but did not work. What else can be done? Please help.

3 REPLIES
txnelson

Super User

Joined:

Jun 22, 2012

For(i=1,i<=10,i++, Add Graphics Script(.............));  Will result in only one of the results, because each "Add Graphics Script" will replace the preceding one.

What structure you need is:

Add Graphics Script(For(i=1,i<=10,i++,....................));   Where only one over all "Add Graphics Script" is evaluated.

If you could please attach your script, or the fragment of the script that is having the issue, it would be of great help in determining the issue.

Jim
jacaalgo

Community Trekker

Joined:

May 10, 2013

Jim, thanks so much for the suggestion, I have it working properly now!

pmroz

Super User

Joined:

Jun 23, 2011

You can also append items to an existing display box, e.g. a vlistbox.

nw = New Window( "Test",

     vlb = V List Box(

           Text Box( "Hello" ),

     ),

);

vlb << append( Text Box( "World" ) );

vlb << append( Text Box( "Santa" ) );

vlb << append( Text Box( "Claus" ) );