WindowID of Mechanical main windows for message box

How I get the WindowID of the Mechanical main window to pop up an error message?MessageBox.Show(???, "Message Box Text", "Message Box Title", MessageBoxType.Error, MessageBoxButtons.OK)
Comments
-
@ThomasDD I don't think this info is needed. Use:
- clr.AddReference("Ans.UI.Toolkit.Base")
- clr.AddReference("Ans.UI.Toolkit")
- from Ansys.UI.Toolkit import *
- MessageBox.Show('test')
or:
- msg = Ansys.Mechanical.Application.Message('my Warning message as string...', MessageSeverityType.Warning)
- ExtAPI.Application.Messages.Add(msg)
0 -
The first answer is known to me. The problem is that the icon cannot be changed.
The second thing I will try. Thanks!
0 -
ChatGPT gave me the right answer!
MessageBox.Show(ExtAPI.UserInterface.MainWindow, "Message Box Text", "Message Box Title", MessageBoxType.Error, MessageBoxButtons.OK)
0 -
ExtAPI.UserInterface.MainWindow seems to work. I get an error message that blocks the Mechanical Window until you click on OK. But the focus on the main Window seems lost after that. It seems that ExtAPI.UserInterface.MainWindow is a small and invisible window and not the Mechanical main window.
ExtAPI.UserInterface.MainWindow.Width returns "2" only, for example...
0 -
ExtAPI.UserInterface.MainWindow.Width = 200
ExtAPI.UserInterface.MainWindow.Height = 200If you change the size of ExtAPI.UserInterface.MainWindow, you see that mysterious thing at the top left corner of the Mechanical Window:
0