Show dialog

A forum devoted to the discussion of all topics having to do with scripting and other advanced programming using iX Developer.
Post Reply
Claus Nielsen
Posts: 18
Joined: Sun May 31, 2015 2:38 am

Show dialog

Post 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?

wlederer
Posts: 175
Joined: Fri Jan 27, 2012 4:20 am

Re: Show dialog

Post by wlederer »

Can You clarify, what is the "discussion" with HMI about? Simple, which screen to open, or something else?

AMitchneck
Posts: 137
Joined: Mon Jun 11, 2012 2:10 pm

Re: Show dialog

Post 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.
Adam M.
Controls Engineer
FlexEnergy

Claus Nielsen
Posts: 18
Joined: Sun May 31, 2015 2:38 am

Re: Show dialog

Post 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.

AMitchneck
Posts: 137
Joined: Mon Jun 11, 2012 2:10 pm

Re: Show dialog

Post 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.
Adam M.
Controls Engineer
FlexEnergy

Post Reply