Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

mouse clicked

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    mouse clicked

    I have a mouse click option in my indicator that displays information but I was wondering if there is a double click instead

    #2
    Hello,
    Thanks for your post.

    Unfortunately, we do not keep documentation on third-party NinjaScripts. I recommend reaching out to the third-party vendor or writer of that indicator for support on this.

    If you have any further NinjaTrader questions please let me know.
    Josh G.NinjaTrader Customer Service

    Comment


      #3
      no it is my indicator on mouse clicking which I got the information from you. I was wondering if NT does double mouseclick.

      protected void MouseClicked(object sender, MouseButtonEventArgs e)
      {
      // convert e.GetPosition for different dpi settings
      clickPoint.X = ChartingExtensions.ConvertToHorizontalPixels(e.Get Position(ChartPanel as IInputElement).X, ChartControl.PresentationSource);
      clickPoint.Y = ChartingExtensions.ConvertToVerticalPixels(e.GetPo sition(ChartPanel as IInputElement).Y, ChartControl.PresentationSource);
      Last edited by ballboy11; 09-29-2017, 07:34 AM.

      Comment


        #4
        Hello,
        Thanks for your note.

        To use a double click in your indicator instead of a single click you will use a combination of ChartControl.PreviewMouseLeftButton and ClickCount. You can implement this similar to the snippet of code below.

        protected override void OnStateChange(){
        if (State == State.SetDefaults)

        else if (State == State.Historical){
        if (ChartControl != null)
        ChartControl.PreviewMouseLeftButtonDown += ChartControl_PreviewMouseLeftButtonDown;
        }
        else if (State == State.Terminated){
        if(ChartControl != null)
        ChartControl.PreviewMouseLeftButtonDown -= ChartControl_PreviewMouseLeftButtonDown;
        }
        }

        private void ChartControl_PreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
        if (e.ClickCount == 2){
        Print("Double click");
        }
        }


        I also suggest checking out this page on WPF Preview Events:
        https://stackoverflow.com/questions/...460266#1460266

        If you have any further questions please let me know.
        Josh G.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by cutzpr, Today, 08:54 AM
        0 responses
        5 views
        0 likes
        Last Post cutzpr
        by cutzpr
         
        Started by benmarkal, Today, 08:44 AM
        0 responses
        5 views
        0 likes
        Last Post benmarkal  
        Started by Tin34, Today, 03:30 AM
        2 responses
        26 views
        0 likes
        Last Post Tin34
        by Tin34
         
        Started by sastrades, Yesterday, 09:59 AM
        2 responses
        39 views
        0 likes
        Last Post brucerobinson  
        Started by ETFVoyageur, Today, 12:52 AM
        1 response
        21 views
        0 likes
        Last Post Leeroy_Jenkins  
        Working...
        X