I am trying to bring this dialog up to ask a question and am perplexed how to get the “Object Parent”. This requires a System.Object. I think this should be a reference to main Rhino Window but I cant find a way to hook it up through “this.parent” or anything else I have tried. Help with the syntax would be much appreciated.
var result = Dialogs.ShowMessage(
'Object Parent' (System.Object),
"Are you sure?",
"Reset",
ShowMessageButton.YesNoCancel,
ShowMessageDefaultButton.Button1,
ShowMessageOptions.SetForeground,
ShowMessageMode.ApplicationModal
);
Rhino.RhinoApp.MainWindow is now obsolete and has been taken over by:
IntPtr me = Rhino.RhinoApp.MainWindowHandle();
I thought that would have worked but it returns the wrong type. Maybe this dialog is no longer supported or we just have not hit on the special sauce yet.
I am running this from a command in a plug in but I don’t think the environment should be the issue.
/// Main Rhino Window
/// 5.0
/// deprecated 6.0 deprecated
[Browsable(false)]
[EditorBrowsable(EditorBrowsableState.Never)]
[Obsolete(“Use MainWindowHandle or RhinoEtoApp.MainWindow in Rhino.UI”)]
public static IWin32Window MainWindow()
{
if (RhinoApp.g_main_window == null)
{
IntPtr handle = RhinoApp.MainWindowHandle();
if (IntPtr.Zero != handle)
RhinoApp.g_main_window = new RhinoWindow(handle);
}
return (IWin32Window) RhinoApp.g_main_window;
}
But it does say to use RhinoEtoApp.MainWindow. I have tried to use both of these but maybe my call is incorrect or I am using the wrong version of the API.
That was it, I got the signature wrong. When I pasted what you sent into the code everything worked. Turned out I forgot to add the Rhino.UI.ShowMessageIcon.Information, property.