BookmarkSubscribeRSS Feed
Choose Language Hide Translation Bar
Highlighted
jacaalgo
Community Trekker

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

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.

0 Kudos
3 REPLIES 3
txnelson
Super User

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

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

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

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

0 Kudos
pmroz
Super User

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

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" ) );