Safe way to display error message boxes


#1

Hi,
Is there a safe window type that can be used to display error messages in a plug-in? In particular I feel compelled to display an error message before the GUI is up, in case of installation / initialization errors. It’s not often they come up, but it would be nice to do it safely.


#2

AlertWindow should do the job.


#3

Thanks Jules. What would happen if the host think it needs to delete the plug-in when AlertWindow is opened?


#4

This might not work well for you, but what I do is launch a second instance of my application, but with a command line option containing the string to display. This causes my app to bring up an AlertWindow instead of running normally. This way, the dialog is guaranteed to come up no matter how bad the state of my main app is. Also, I can kill my main app process, leaving the dialogue up.


#5

If you’re using the normal modal loops, then you’d be f**ked.

Running any kind of modal loop in a plugin is risky - you can avoid it by creating your window and using Component::enterModalState to make it modal and attach a callback that will be triggered when it’s finished. This method is much more laborious than just running an inline modal loop, but is safe - it’s how the library does its menus, comboboxes, etc.