Pre loader

Parameters for ModifierTouchEventArgs

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



I am having trouble determining the parameters to pass to ModifierTouchEventArgs when overriding GestureModifierBase in the latest SciChart versions. I can’t figure out where to get the now required source and target values – the super class returns null when asked.. Code snippet below…

class MyCustomGestureModifier() : GestureModifierBase() {
    override fun onLongPress(e: MotionEvent?) {

    /* This worked in SciChart v4.2.0.4557, but no longer does due to ModifierTouchEvents now requiring source and target
    val args = ModifierTouchEventArgs()
    args.e = e
    args.isHandled = false
    args.isMaster = true
    args.isInSourceBounds = true

    // create touch event args for rollover modifier
    // wants additional parameters for source and target
    val orgEvent = originalTouchEvent // this is null, so where should we get source and target?
    val args = ModifierTouchEventArgs(orgEvent.source,
    args.e = e
    args.isHandled = false



In case it helps, the above snippet is based on a previous discussion at

Thank you.

  • You must to post comments
Best Answer

Hi there,

We’ve added these parameters because we had a bug with handling touch events when touch events are shared between several charts ( to correctly handle and transform touch coordinates we need to know source of touch event and target which should handle this event ). By default ModifierTouchEventArgs is created internally by our MotionEventManager implementation which manages Android touch event subscriptions.

If you need to create ModifierTouchEventArgs instance you can override onTouch() method in your modifier and store source and target into private fields before calling super.onTouch(). Then you can read these values when long press is detected.

The other way is you use single chart and don’t share touch events between many charts is to specify parent SciChartSurface of modifier as source and rollover modiier as target.

Is this suitable for your needs?

Best regards,

  • C Bolton
    Thank you. That got it working again.
  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.