cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • Learn how to build custom Python data connectors and further customize JMP’s Data Connector Framework with the Python Data Connector Demo, available now in the JMP Marketplace!
  • See how to create experiments to support product design and ID useful product features. Register for June 12 webinar, 2pm US Eastern Time.

Discussions

Solve problems, and share tips and tricks with other JMP users.
Choose Language Hide Translation Bar
hogi
Level XIII

how to use JSL to edit a modal dialog window

What is the right approach to edit a modal dialog via JSL?

 

the idea:

- the function add update button adds a button to the data filter

- it works if it is executed AFTER the creation of the window

- in the actual use case, the return value of the window is used as input for the subsequent code.
   Therefore, <<Type( "Modal Dialog" )
-> the window will be closed before add update button() //post gets executed 

 

- I tried to add the add update button()  via << on open (
 
... without success 

 

 

Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );

dt << Add Properties to Table(
	{New Script("reread", JSL Quote(caption("reread ...")),	As String( 1 ))});
	
add update button = function ({},
wait();
Current Report()["Local Data Filter",LineUpBox(1)] <<
append(
	b = Button Box( "update",
		b << close window();
		dt << run script( "reread" );
		ShowQueryWindow();				
	)
));

ShowQueryWindow = Function({},
	gui = New Window( "test", 
	//<<Type( "Modal Dialog" ),
	<< on open(add update button()), // doesn't work
		dt << data filter( local )
	)
);

ShowQueryWindow();

add update button() //post: works
1 ACCEPTED SOLUTION

Accepted Solutions

Re: how to use JSL to edit a modal dialog window

One approach for this in JMP 18 is to use a window handler.  The window handler is a function wrapper that allows you to access any window created during the execution of the function.  We are looking at making modal and non-modal behaviors more consistent in upcoming major releases, which should make this easier to do directly through the New Window() function in the future.

 

 

Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );

dt << Add Properties to Table(
	{New Script("reread", JSL Quote(caption("reread ...")),	As String( 1 ))});
	
add update button = function ({win},
win["Local Data Filter",LineUpBox(1)] <<
append(
	b = Button Box( "update",
		b << close window();
		dt << run script( "reread" );
		ShowQueryWindow();				
	)
));

showFilter = Function({},
	With Window Handler(
		New Window( "test", 
			<<Type( "Modal Dialog" ),
			dt << data filter( local )
		),
		Function({win},
			add update button(win);
		);
	)
);

showFilter();

 

 

View solution in original post

3 REPLIES 3

Re: how to use JSL to edit a modal dialog window

One approach for this in JMP 18 is to use a window handler.  The window handler is a function wrapper that allows you to access any window created during the execution of the function.  We are looking at making modal and non-modal behaviors more consistent in upcoming major releases, which should make this easier to do directly through the New Window() function in the future.

 

 

Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );

dt << Add Properties to Table(
	{New Script("reread", JSL Quote(caption("reread ...")),	As String( 1 ))});
	
add update button = function ({win},
win["Local Data Filter",LineUpBox(1)] <<
append(
	b = Button Box( "update",
		b << close window();
		dt << run script( "reread" );
		ShowQueryWindow();				
	)
));

showFilter = Function({},
	With Window Handler(
		New Window( "test", 
			<<Type( "Modal Dialog" ),
			dt << data filter( local )
		),
		Function({win},
			add update button(win);
		);
	)
);

showFilter();

 

 

hogi
Level XIII

Re: how to use JSL to edit a modal dialog window

hi @danschikore, thanks a lot
wonderful :)

jthi
Super User

Re: how to use JSL to edit a modal dialog window

Are you trying to add the update button to the modal window? If you are, I don't think modal window is a report window (it is modal or modal dialog) -> build the modal window in different way

Names Default To Here(1);

dt = Open("$SAMPLE_DATA/Big Class.jmp");

dt << New Script("reread", JSL Quote(caption("reread ...")), As String(1));


add update button = Function({ref},
	ref["Local Data Filter", Lineup Box(1)] << append(
		b = Button Box("update",
			b << close window();
			dt << run script("reread");
		)
	);
);

showFilter = Function({},
	collector = V List Box(
		dt << data filter(local)
	);
	add update button(collector);
	gui = New Window("test", <<Type("Modal Dialog"),
		collector,
		Button Box("Windows",
			Show(Get Window(Type("Reports")));
			Show(Current Report());
		);
	);
);

showFilter();

I would also suggest trying to add {Default Local} (or defined variable names) to your functions to avoid possible issues but it will require some additional scripting.

-Jarmo

Recommended Articles