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

Calling SetFocus on a child window in SettingsDialog.postInit has the side effect of also showing the dialog #5951

Closed
jscholes opened this issue May 15, 2016 · 8 comments

Comments

@jscholes
Copy link

In All of the built-in settings dialogs, the SettingsDialog.postInit method is overridden to set focus to the first focusable child control in that dialog. For example, in SettingsDialogs.GeneralSettingsDialog.postInit, focus is set to the list of languages. This behaviour is encouraged in the SettingsDialog.postInit docstring.

However, perhaps due to a wx bug or maybe this is intended behaviour, this has the side effect of also showing the dialog, regardless of whether the dialog's Show method is subsequently called. This makes the dialogs unsuitable for instantiation in code which doesn't necessarily want to show them on screen straight away (or at all).

If explicitly setting focus to the first child control is really necessary, which it shouldn't be as it usually happens automatically in wx dialogs, this should only take place in a method designated as a handler for a wx.EVT_SHOW event. I'm happy to submit a pull request at some point if this is an appropriate change, although you may have thoughts on how to implement this with minimal API changes.

@jcsteh
Copy link
Contributor

jcsteh commented May 15, 2016 via email

@LeonarddeR
Copy link
Collaborator

LeonarddeR commented Feb 9, 2018

I belief my playing with #577 didn't reveal this issue, It does change the focus in a dialog when it is hidden and it seems that it does only show up when it is explicitly said to do so.

Having said that, I think it is good to postpone attention to this until #7077 / #7104 is settled down.

@ehollig
Copy link
Collaborator

ehollig commented Oct 26, 2018

@LeonarddeR, now that the above issues have settled down, is it worth bringing the attention of this issue up again?

@Adriani90
Copy link
Collaborator

@jscholes, @LeonarddeR do you still see this issue?

@Adriani90
Copy link
Collaborator

@jscholes are you still available?

@LeonarddeR
Copy link
Collaborator

I'm also pretty sure that wx doesn't set focus correctly if we don't do this explicitly.

@jscholes
Copy link
Author

jscholes commented Mar 6, 2019

As far as I know, this is still an issue in wxPython. But since I filed this issue the Settings dialog has been completely revamped. Originally, I filed it because of the way a particular add-on (https://github.com/ABuffEr/rapidSettings) worked, but the new unified Settings dialog makes that add-on obsolete. Feel free to close it.

@Adriani90
Copy link
Collaborator

Closing as requested. If there are specific issues related to this topic, please comment on this and we can reopen it. or create a new issue if needed. Thanks.

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

5 participants