Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Creating a non-modal window from wxHtmlHelpController #24527

Open
solemnwarning opened this issue May 13, 2024 · 3 comments
Open

Creating a non-modal window from wxHtmlHelpController #24527

solemnwarning opened this issue May 13, 2024 · 3 comments

Comments

@solemnwarning
Copy link
Contributor

Bug description:

I'm trying to display a page from my application's manual from the (modal) settings dialog using wxHtmlHelpController, however any DisplayXXX() calls block when the dialog is open until the help window is closed, even when no parent window is specified and wxHF_DIALOG is not specified.

I've dug through the code of wxHtmlHelpController and associated classes and can't find any way to do what I want right now. Internally, the wxHtmlHelpController::DisplayXXX() methods are calling wxHtmlHelpController::MakeModalIfNeeded(), which descends down into wxHtmlHelpFrame::AddGrabIfNeeded(), which makes the help frame modal "'if needed'" (i.e. if any modal dialogs happen to exist..?).

Expected vs observed behaviour:

wxHtmlHelpController::DisplayXXX() should return immediately, giving the application a chance to do things to the help window (e.g. bind the wxEVT_HTML_LINK_CLICKED event) and allowing the user to continue interacting with the application.

Platform and version information

  • wxWidgets version: 3.2.2
  • wxWidgets port: wxGTK
  • OS: Debian 12
    • GTK version: 3.24.38
    • Which GDK backend is used: X11
    • Desktop environment: Trinity
@solemnwarning
Copy link
Contributor Author

I've done a bit more testing and I think this is due to a misunderstanding I had regarding modal dialogs in wxWidgets - I thought creating a modal dialog only blocked input to the parent window heirarchy, however they generally seem to actually block interaction with all other windows in the application (tested on GTK, Windows and macOS).

So I suppose the wxHtmlHelpController window having to also be modal relative to the creating modal dialog is an unfortunate side-effect of that design... still feels a bit like a bug for both the event binding reason above and not allowing the user to interact with the modal they are trying to read the manual for.

I've changed my settings dialog to be non-modal instead as a workaround. In my unqualified opinion, the best outcome here would be for the help window itself to somehow be a non-modal window which still allows setting up event bindings and the user to interact with modal windows in the program.

@vadz
Copy link
Contributor

vadz commented May 15, 2024

This is known as app-model vs window-modal and default modality is app modal because it's expected that ShowModal() only returns when the dialog is dismissed. There is wxDialog::ShowWindowModal() but you'd have to use it for the dialog itself and not (just) the help window.

@solemnwarning
Copy link
Contributor Author

Thanks for the tip about wxDialog::ShowWindowModal() - I thought that was the behaviour of ShowModal().

I already worked around this problem in my application by making my dialog non-modal, so this is no longer an issue for me, but I tried using ShowWindowModal() and on GTK at least, the resulting dialog is still app-modal rather than window-modal, and the call to wxHTMLHelpController::Display() continues to block until the help window is closed (and blocks interaction with the previous modal dialog).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants