Pre loader

Keyboard shortcuts to enable AnnotationCreationModifier

Welcome to the SciChart Forums!

  • Please read our Question Asking Guidelines for how to format a good question
  • Some reputation is required to post answers. Get up-voted to avoid the spam filter!
  • We welcome community answers and upvotes. Every Q&A improves SciChart for everyone

WPF Forums | JavaScript Forums | Android Forums | iOS Forums

0
0

Hi, there.

Our users want CreateAnnotationModifier be active while Control button is pressed. Also they want to delete selected annotation with delete button.

I add handlers for

sciChartSurface.KeyDown
sciChartSurface.KeyUp
sciChartSurface.GotFocus
sciChartSurface.GotMouseCapture
sciChartSurface.PreviewKeyDown

When control capture mouse it can do not recieve focus, thereby button events do not handle.
I am not sure but when control has focus it can not handle button events too.

Chart start handle button events when I am select annotation and click on chart after it.

It is impossible to manually call Focus(), because application has other controls.

When I am delete or add annotation chart loss and recieve focus many times.

Is this correct behaviour?

What additional information do you need for fixing this issue?

  • You must to post comments
1
0

Hi Kiril,

there is built-in way to achieve that with modifiers. You need to extend existing AnnotationCreationModifier, and check ModifierMouseArgs.Modifier for keyboards modifiers:

    public class AnnotationCreationModifierEx: AnnotationCreationModifier
    {
        public override void OnModifierMouseUp(ModifierMouseArgs mouseButtonEventArgs)
        {
            if (
                //checks for the first point
                (mouseButtonEventArgs.Modifier == MouseModifier.Ctrl && (Annotation == null || Annotation.IsSelected)) ||
                //checks for the second point
                (Annotation != null && !Annotation.IsSelected))
            {

                //fix for another issue, which appears if Y axis is left-aligned,
                //you may omit it
                var translatedPoint = GetPointRelativeTo(mouseButtonEventArgs.MousePoint, ModifierSurface);
                mouseButtonEventArgs.MousePoint = translatedPoint;

                //call base implementation
                base.OnModifierMouseUp(mouseButtonEventArgs);
            }
        }
    }

Please, try the above and give us any feedback.

Best regards,
Yuriy

  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.

Try SciChart Today

Start a trial and discover why we are the choice
of demanding developers worldwide

Start TrialCase Studies