cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • Don’t miss your chance to experience Discovery Summit Europe at our best available rate! Early bird registration through 31 Oct.
  • Graph Builder Toolbar streamlines interactive graphing. Creates shortcuts on Report and GraphBuilder Helpers toolbars. Download and install the extension.
  • JMP will suspend normal business operations for our Rest and Recharge Day on Friday, October 2, 2026.
    Regular business hours will resume on Monday, October 5, 2026.

Uncharted

Choose Language Hide Translation Bar
Craige_Hales
Super User
Progress Bar

Re: Does JSL provide a "busy" indicator similar to a spinning wheel or bar?

 

here's an example of a progress indicator made in JSL; it uses a namespace to encapsulate the code.  The last few lines are a test, try setting workload ​bigger or smaller.  For smooth performance the progress:set function must be called fairly often. The progress:init function needs to know the total amount of work that will be done to get the percentage right.

 

Edit: attached a copy of the JSL, apparently the inline JSL may not display correctly.

11084_progress.PNG

progress = New Namespace(
	"progress"
);
progress:init = Function( {workload},
	progress:TotalWork = workload;
	progress:Current = -1;
	progress:tick = Tick Seconds();
	progress:Window = New Window( "progress",
		H List Box(
			Spacer Box( size( 20, 20 ) ),
			progress:busy = Busy Light( <<size( 60, 60 ) ),
			Border Box( Left( 20 ), Right( 20 ), top( 20 ), bottom( 20 ),
				H List Box(
					progress:left = Spacer Box( color( RGB Color( 20, 200, 20 ) ) ),
					progress:right = Spacer Box( color( RGB Color( 100, 100, 100 ) ) ),
					Spacer Box( size( 20, 10 ) ),
					progress:text = Text Box( "0" )
				)
			)
		)
	);
	progress:set( 0 );
);
progress:set = Function( {workdone},
	{now = Tick Seconds(), pct = Round( 100 * workdone / progress:TotalWork )},
	If( now - progress:tick > 1 / 30,
		progress:tick = now;
		If( pct != progress:Current,
			progress:Current = pct;
			progress:left << size( progress:Current, 20 );
			progress:right << size( 100 - progress:Current, 20 );
			progress:text << settext( Char( pct ) || "%" );
		);
		progress:busy << advance;
		Wait( 0 );
	)
);
progress:term = Function( {},
	progress:Window << closeWindow
);
/////////////////////////
// test
/////////////////////////
workload = 1e6; // 1e6 is about 5 seconds
progress:init( workload );
For( i = 1, i <= workload, i++,
	progress:set( i )
);
progress:term();

 

Last Modified: Oct 25, 2018 9:48 PM
Comments