Is there an equivalent of MessageBox.Show()
in MonoMac, or do I have to create a some sort of popup class specifically for this purpose?
You're looking for NSAlert, which is a mostly equivalent to MessageBox.
You can show an NSAlert by using NSAlert.RunModal(), or use NSAlert.BeginSheet() if you want it to show up as a sheet on a particular window.
e.g.
var alert = new NSAlert {
MessageText = "Hello, this is an alert!",
AlertStyle = NSAlertStyle.Informational
};
alert.AddButton ("OK");
alert.AddButton ("Cancel");
var returnValue = alert.RunModal();
// returnValue will be 1000 for OK, 1001 for Cancel
You can take a look at how to use it a bit more from a MonoMac perspective here:
https://github.com/picoe/Eto/blob/master/Source/Eto.Platform.Mac/Forms/MessageBoxHandler.cs
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With