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

How do I wait until a button is pressed in a function of another file to return to the main file?

I'm having an issue in my code where I press a button and it goes into another function in another file (using Include("filename.jsl"); Once the button is pressed the function from the other file runs and returns back to the main function in the main file and continues running. This is not what I want.

 

How can I make it so the code stops in the second function (the one in another file) and wait for the Ok button to be pressed before returning back to the original function in the main file?

4 REPLIES 4
jthi
Super User

Re: How do I wait until a button is pressed in a function of another file to return to the main file?

I'm not exactly sure what is the problem, but maybe using modal windows would help?

Names Default To Here(1);

nw_expr = Expr(New Window("2", << modal,
	Text Box("Second")
	, << Move Window(0,0)
));

nw = New Window("1", << modal,
	Button Box("2", nw_expr);
);

Show("Continue");
-Jarmo
Andyon98
Level II

Re: How do I wait until a button is pressed in a function of another file to return to the main file?

My issue is when I press button on the on the first menu, the code runs on even though another window has popped up. I want to have it so it will only continue if a button is pressed on the second window. 

jthi
Super User

Re: How do I wait until a button is pressed in a function of another file to return to the main file?

Maybe this updated example gives more ideas, run it and while pressing the buttons check out log:

Names Default To Here(1);

nw_expr = Expr(New Window("2", << modal,
	Text Box("Second")
	, << Move Window(0,0)
));

nw = New Window("1", << modal,
	Button Box("2", 
		nw_expr;
		Show("Continue inside window");
	);
);

Show("Continue outside window");
-Jarmo
pmroz
Super User

Re: How do I wait until a button is pressed in a function of another file to return to the main file?

You need to have the new window() call in your second file use the << modal construct as @jthi mentioned.