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

Basic fix for KeyTips not working when focus is inside a WinForms control #254

Merged
merged 1 commit into from
Jan 26, 2016

Conversation

floele-ww
Copy link
Contributor

When pressing Alt and then a letter (input focus: WinForms textbox), Alt
will make the KeyTips show, but the letter will be typed into the
focused WinForms control instead of navigating through the ribbon. As
far as I can see, the reason for this is primarily that
OnFocusedElementPreviewTextInput can not be attached to the currently
focused WinForms control. This behaviour has not been an issue in older
versions of Fluent.

In order to fix the problem, in OnWindowKeyDown() e.Key will be
forwarded to the KeyTip adorners. This fix is incomplete though. Since
all keys must be set to "handled" here to avoid typing into the WinForms
textbox, this will also swallow the "up/down" navigation in menus. I'm
not quite sure what the best approach for fixing this should be.

I also modified the showcase app to show the two different textboxes for
testing the key tip behaviours in both scenarios.

…trol

When pressing Alt and then a letter (input focus: WinForms textbox), Alt
will make the KeyTips show, but the letter will be typed into the
focused WinForms control instead of navigating through the ribbon. As
far as I can see, the reason for this is primarily that
OnFocusedElementPreviewTextInput can not be attached to the currently
focused WinForms control. This behaviour has not been an issue in older
versions of Fluent.

In order to fix the problem, in OnWindowKeyDown() e.Key will be
forwarded to the KeyTip adorners. This fix is incomplete though. Since
all keys must be set to "handled" here to avoid typing into the WinForms
textbox, this will also swallow the "up/down" navigation in menus. I'm
not quite sure what the best approach for fixing this should be.

I also modified the showcase app to show the two different textboxes for
testing the key tip behaviours in both scenarios.
@batzen
Copy link
Member

batzen commented Jan 26, 2016

Will merge this, but please have a look at the AppVeyor build results after you proposed a PR.
You forgot to also add the Windows.Forms references to the .NET 4.0 project.

@batzen batzen added this to the 4.0.0 milestone Jan 26, 2016
batzen added a commit that referenced this pull request Jan 26, 2016
Basic fix for KeyTips not working when focus is inside a WinForms control
@batzen batzen merged commit 03ce877 into fluentribbon:develop Jan 26, 2016
@batzen
Copy link
Member

batzen commented Jan 26, 2016

And thanks for contributing!

This also inspired me to start my refactoring on the keytip adorner, completely getting rid of focus tracking there. ;-)

batzen added a commit that referenced this pull request Jan 26, 2016
@floele-ww
Copy link
Contributor Author

This also inspired me to start my refactoring on the keytip adorner,

That sounds good, but what does it mean exactly? ;)
In theory, the changes I made have to be extended a little so that the menu item navigation doesn't stay broken. So are you going to rewrite all of that anyway right now or are you interested in continuing what I started? In the latter case, would you like me to make a proposal for fixing the menu issue or do you already have your own idea?

@batzen
Copy link
Member

batzen commented Jan 27, 2016

That sounds good, but what does it mean exactly? ;)

I means that i will remove everything related to focus tracking and keyboard input from the adorner class and handle that in the service. Currently keyboard input is handled in both classes, which makes it kind of difficult to follow the code.

So are you going to rewrite all of that anyway right now or are you interested in continuing what I started?

Not really rewriting, just consolidating and "moving" code.

In the latter case, would you like me to make a proposal for fixing the menu issue or do you already have your own idea?

I am always interested in suggestions on how to fix issues and this part is, coincidentally, the last remaining one and where i stopped yesterday. ;-)

@floele-ww
Copy link
Contributor Author

coincidentally, the last remaining one and where i stopped yesterday. ;-)

OK, I can look into that further...but as far as I can see you didn't check in any changes yet? I assume it would be good to have the current code for working on a solution.

@batzen
Copy link
Member

batzen commented Jan 27, 2016

Will push my changes later.
Tracking the refactoring in #258 now.

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

Successfully merging this pull request may close these issues.

2 participants