How to build custom alert windows for plugin

Hi All,

I’ve seen many threads saying that its bad practice to have modal dialogs in a plugin, with the common suggestion being to build a custom component that sits on top of the plugin and becomes visible when it is called. I’ve managed to implement this but am now having trouble figuring out how I can return a value before the program continues (Yes, No, Cancel). Is there any example code out there that I can look at or does anyone have an idea of how this can be achieved?

Really it comes down to just blocking (in a visual, UX sense) other parts of the GUI from being accessed while the dialog is open.

For example we have a licensing dialog in our plugins that is added to the main view and covers all other components. If the user wants the dialog to go away they have to click the close button (to continue unlicensed) or enter in their license key. If their license gets validated we simply remove the dialog component and update the text in our title bar to show that it’s been licensed. Basically you’re relying on callbacks instead of breaking out of a modal loop with a return value.

Modal dialog windows (that spawn as a new window) will definitely give your user trouble. I believe modal components in the way I mentioned above may be problematic as well, but I haven’t used modal loops for any type of dialog in our products.

Thanks for the response! It took some time for me to restructure my functions but it works now as a callback. I appreciate the help!

1 Like