Info Box

Anyone know an information box you can have pop up but still move the screen around or adjust what your looking at and then press ok? ex. user zooms in on a certain section, then press ok.

i tried, NXMessageBox.Show( "" , NXMessageBox.DialogType.Information , "" )

and MessageBox.Show

An application can show a dialog box (or form) as modal or modeless. A modal form will take over control of the application until the user responds to it. The NXMessageBox and MessageBox are modal by default. A modeless dialog will allow the user to interact with the main application while the dialog is open.

One of the limitations of journals is that you can only use modal dialogs. To use modeless dialogs, you will need to have an NXOpen author license and you will need to compile the code.

Hello Cowski,
Can you make a simple example but with MODELESS Windows Form?
I have the NX AUTHOR LICENSE and I can compile it.
Thanks

Carlo Tony Daristotile

Unfortunately, no; I don't currently have access to an author license so I would not be able to test any of the code for accuracy.

However, if you have an author license, you could use any of the journal code that uses a windows form as a starting point. Change the call to .ShowDialog to .Show to see how it behaves.

I tried that.
The Windows Form appears then disappears, in the blink of an eye.

Carlo Tony Daristotile

With a modal form, the code that shows the form (the Sub Main in most of my examples) will halt execution until the form is closed. With a modeless form, the code continues to execute regardless of what's happening with the form (this is one reason why they are more difficult to code). You will want to add some sort of check that keeps the journal from exiting until the form is dismissed by the user.

Trying to use modeless dialogs is a pain. Can you use the Info window to display your message, instead?

Some info from the SNAP Getting Started guide, which might be relevant:

As before, we’re using form.ShowDialog to display the dialog, so it will be “modal”, which means that we can’t do anything else until we close the form. There is also myForm.Show, which creates a non-modal form, but to use this, you have to change the GetUnloadOption function in the file Unload.vb. Specifically, you have to modify this function to return Snap.UnloadOption.AtTermination instead of Snap.UnloadOption.Immediately. If you fail to do this, your dialog will disappear a second or two after it’s displayed, so you’ll probably never see it.

Good call, ciao. I forgot to mention that you will need to change the unload option.