cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Choose Language Hide Translation Bar
jc510_2
Level III

Bring Window To Front not working properly?

[JMP 17.0.0]

 

This may be kind of obscure, but let's say I create a new project that contains two data tables: Table 1 and Table 2.  In Table 1, I have a script to duplicate Table 2 in a new Table 3 (if Table 3 doesn't already exist), then bring the focus back to Table 2:

 

dt = Data Table( "Table 2");

If( Try( Data Table("Table 3") << Get Name, "") == "",

	dt << Subset(
		Output Table( "Table 3" ),
		All rows,
		Selected columns only( 0 )
	);
	
);
	
Window( "Table 2") << Bring Window To Front;

After the script runs, this should change the window focus to Table 2, but instead the focus is on Table 3.  Subsequently running the script brings the focus to Table 2 as intended.

 

Not sure what I'm missing.

 

Joel

1 ACCEPTED SOLUTION

Accepted Solutions
mmarchandTSI
Level V

Re: Bring Window To Front not working properly?

This is one of those scenarios which call for the Wait() function.

 

dt = Data Table( "Table 2");

If( Try( Data Table("Table 3") << Get Name, "") == "",

	dt << Subset(
		Output Table( "Table 3" ),
		All rows,
		Selected columns only( 0 )
	);
	Wait(0)
);
	
Window( "Table 2") << Bring Window To Front;

View solution in original post

2 REPLIES 2
mmarchandTSI
Level V

Re: Bring Window To Front not working properly?

This is one of those scenarios which call for the Wait() function.

 

dt = Data Table( "Table 2");

If( Try( Data Table("Table 3") << Get Name, "") == "",

	dt << Subset(
		Output Table( "Table 3" ),
		All rows,
		Selected columns only( 0 )
	);
	Wait(0)
);
	
Window( "Table 2") << Bring Window To Front;
jc510_2
Level III

Re: Bring Window To Front not working properly?

Yes - that is exactly it.  This is the first time I've run across a need for the Wait function.

 

Thank you!