Page 1 of 1

Show dialog

Posted: Thu Jul 23, 2015 11:59 pm
by Claus Nielsen
Hello

Anyone know if it is possible to to show a screen as a dialog instead of new screen? Like with the windows form class .ShowDialog? Also, if it is possible, how to set Dialog Result for buttons?

Re: Show dialog

Posted: Wed Jul 29, 2015 6:30 am
by wlederer
Can You clarify, what is the "discussion" with HMI about? Simple, which screen to open, or something else?

Re: Show dialog

Posted: Thu Jul 30, 2015 1:15 pm
by AMitchneck
To make a screen be a dialog instead of a window, under the General properties ribbon, select Popup and Modal (to have window just be like tool window, do not select Modal).

To pass Dialog results you can use a tag or something like

Code: Select all

result = ((System.Windows.Forms.Form)(Globals.ScreenName)).ShowDialog();
I will note, I've never tried to show a screen by directly using ShowDialog so I'm not 100% sure what to expect.

To get a button to return a dialog result of OK, add the following code to the button's click event

Code: Select all

DialogResult = DialogResult.OK;
This will also close the dialog window.

Re: Show dialog

Posted: Fri Jul 31, 2015 10:31 am
by Claus Nielsen
AMitchneck, I've tried your solution, but it ends up with a conversion fault when casting the object ScreenWindowsAdapter to a Forms.Form object.

Re: Show dialog

Posted: Tue Aug 04, 2015 6:57 am
by AMitchneck
Claus,

As I mentioned, I've never tried to call the ShowDialog method directly. What I do is set the dialog screen general settings to popup and modal. This makes the iX's show function work like the ShowDialog function, but without the result. To pass a result, I set a tag within the dialog.