How to support Ctrl+Click on button of MiniToolbar in unfocused view

Ribbon for WPF Forum

Posted 4 years ago by Lars Klose
Version: 18.1.0674
Avatar

I have a minitoolbar implemented using the ActiPro Ribbon MiniToolBarService. Some of the buttons on the minitoolbar should expose a slightly altered behavior when the Ctrl-Key is held while clicking the button (analoguously to ctrl+clicking a link in a browser to open it in a new tab instead of in-place). The minitoolbar is displayed in a document window regardless if another tool window currently has the focus, because we want to avoid having the user setting the focus to the desired view explicitly before interacting with it.

However, the ctrl+click behavior currently only works if the focus is in the component which hosts the minitoolbar. If the focus is currently in some other view, pressing the Ctrl key already hides the minitoolbar. In blueprint code I see that the reason is that the minitoolbar is hidden unconditionally if any key is pressed but IsKeyboardFocusWithin is false.

First question: wouldn't it be more correct to not hide the minitoolbar automatically when only a modifier key is pressed?

Second question: if it has to be that way - how can I work around this and achieve the decribed desired behavior?

I already tried setting/resetting the keyboard focus explicitly to the minitoolbar on MouseEnter/MouseLeave, but then there are other undesirable side effects. Keyboard navigation through the minitoolbar buttons is not desirable as the minitoolbar itself cannot be display through keyboard, plus the keyboard focus highlight on the button cannot be removed anymore and shows up on the next call to MiniToolBarService.Show. Setting all buttons to focusable=false etc. works to some extent but then calling MiniToolBarService.Hide from the Click handler doesn't seem to have any effect anymore. So this seems a dead end.

[Modified 4 years ago]

Comments (3)

Answer - Posted 4 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi Lars,

We're fine with making that change to not close the mini-toolbar for modifier keys when the mini-toolbar doesn't have focus.

We will update the MiniToolBarService.ProcessPreviewKeyDown method to have this final 'else if':

else if (!toolBar.IsKeyboardFocusWithin) {
	switch (e.Key) {
		case Key.LeftCtrl:
		case Key.LeftShift:
		case Key.RightCtrl:
		case Key.RightShift:
			// No-op for modifier key down
			break;
		default:
			// Close the mini-toolbar
			this.HideCore();
			break;
	}
}


Actipro Software Support

Posted 4 years ago by Lars Klose
Avatar

Hi,

thanks for the positive response, great news!
What released version/build should I expect the change to appear in? Can we get a preview through our organization account?

[Modified 4 years ago]

Posted 4 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi Lars,

It will be in build 686.  We are still collecting updates for it while we work on v2020.1, but it should be out in the next several weeks.  If you write our support address and mention this thread, we can send you a link to a preview build with the change.


Actipro Software Support

The latest build of this product (v24.1.3) was released 3 months ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.