PreviewLostKeyboardFocus interrupts tab interaction

A forum dedicated to WPF version of LightningChart Ultimate.

Moderator: Queue Moderators

Post Reply
User avatar
vrmitch
Posts: 21
Joined: Thu Oct 09, 2014 6:19 pm

PreviewLostKeyboardFocus interrupts tab interaction

Post by vrmitch » Fri May 15, 2015 9:09 pm

Hello,

In resolving an issue I found that it is in fact due to handler for PreviewLostKeyboardFocus in LightningChart.WPF.cs, where e.Handled is true if the last key pressed was anything but Tab or a system key. As a result, an instance of LCU in a tab with which a user is interacting via the keyboard will prevent the next click on another tab from actually changing tabs. This may affect other interactions like buttons as well, but tabs I know for sure. Commenting out the line where e.Handled is set in that method in the LCU source resolves the issue, but we don't want to introduce other issues. I thought it best to take it directly to you so you can resolve it. I find it likely that other people are having this issue as well.

To reproduce the issue, here is some source.
While running, click on the chart in the first tab, hit any key other than tab or an F key, then click the second tab header. The click on the second tab header is lost.

<CODE - MainWindow.xaml>
<Window x:Class="WpfApplication1.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006 ... esentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:lcu="http://www.arction.com/schemas/"
Title="MainWindow">
<TabControl>
<TabItem Header="Tab1" x:Name="tab1" />
<TabItem Header="Tab2" x:Name="tab2" />
</TabControl>
</Window>
</CODE>

<CODE - MainWindow.xaml.cs>
using Arction.WPF.LightningChartUltimate;
using System.Windows;

namespace WpfApplication1
{
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();

tab1.Content = new LightningChartUltimate();
tab2.Content = new LightningChartUltimate();
}
}
}
</CODE>

User avatar
vrmitch
Posts: 21
Joined: Thu Oct 09, 2014 6:19 pm

Re: PreviewLostKeyboardFocus interrupts tab interaction

Post by vrmitch » Mon May 18, 2015 12:55 pm

Confirmed that buttons are not affected, but TabGroup still definitely is.

ArctionJari

Re: PreviewLostKeyboardFocus interrupts tab interaction

Post by ArctionJari » Tue May 19, 2015 7:46 am

The PreviewKeyDown related code was added to prevent chart's scroll bar to lose focus when e.g. right arrow key was held down. I'll look into this and try to make it better. I'll keep you posted.

ArctionJari

Re: PreviewLostKeyboardFocus interrupts tab interaction

Post by ArctionJari » Tue May 19, 2015 8:16 am

If you can build the source code then, as a workaround, subscribe to PreviewKeyUp event and set m_bPreviewKey to false. Works fine in my tests. If this works in every situation I think I'll leave it there permanently.

User avatar
vrmitch
Posts: 21
Joined: Thu Oct 09, 2014 6:19 pm

Re: PreviewLostKeyboardFocus interrupts tab interaction

Post by vrmitch » Tue May 19, 2015 12:21 pm

We would prefer to just have this resolved in a future release, hopefully in the near future.

ArctionJari

Re: PreviewLostKeyboardFocus interrupts tab interaction

Post by ArctionJari » Tue May 19, 2015 12:50 pm

We are planning to release a new version next week. This fix will be included in that version.

User avatar
vrmitch
Posts: 21
Joined: Thu Oct 09, 2014 6:19 pm

Re: PreviewLostKeyboardFocus interrupts tab interaction

Post by vrmitch » Tue May 19, 2015 1:17 pm

Epic, thanks much Jari!

Post Reply