Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Problem clic on panel

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

    Problem clic on panel


    Hello, I designed an indicator that when clicking on the panel draws a box with information in the same onrender panel, the click basically receives the bar and with that bar I get the information I want, there are people that it doesn't work well for them, so I can accept them that click and to be able to reference the bar they need to raise the indicator panel higher and at the bottom then if it works normally​


    I don't know what could be happening for this to happen, it works correctly for most of us.

    #2
    Hello RubenCazorla,

    From the given details I would not be sure what specifically may be happening. Its possible that relates to the windows DPI setting, you may want to check if they have a different than normal DPI setting. Other than that you would likely need to debug the script to see what specific logic is being affected so we have a better idea of what the problem could be related to.
    JesseNinjaTrader Customer Service

    Comment


      #3
      Click image for larger version

Name:	image.png
Views:	23
Size:	97.2 KB
ID:	1321222

      In this image you can see the problem, both clicks are inside the panel, but one of them calculates it as if it were outside

      private void OnMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
      {
      // Obtener la fuente de presentación del ChartControl
      var source = PresentationSource.FromVisual(ChartControl);

      // Obtener la posición del ratón
      Point mousePosition = e.GetPosition(ChartControl);

      // Ajustar las coordenadas del ratón según el DPI
      double dpiX = 1.0, dpiY = 1.0;
      if (source != null && source.CompositionTarget != null)
      {
      dpiX = source.CompositionTarget.TransformToDevice.M11;
      dpiY = source.CompositionTarget.TransformToDevice.M22;
      }

      int mouseX = (int)Math.Round(mousePosition.X * dpiX);
      int mouseY = (int)Math.Round(mousePosition.Y * dpiY);

      // Calcular los bordes del panel
      double panelLeft = chartPanel.X * dpiX;
      double panelTop = chartPanel.Y * dpiY;
      double panelRight = (panelLeft + chartPanel.W) * dpiX;
      double panelBottom = (panelTop + chartPanel.H) * dpiY;

      // Verificar si la posición ajustada del ratón está dentro del panel
      if (mouseX >= panelLeft && mouseX <= panelRight && mouseY >= panelTop && mouseY <= panelBottom)
      {
      mouseDown = true;
      }
      }



      private void OnMouseLeftButtonUp(object sender, MouseButtonEventArgs e)
      {
      Point mousePosition = e.GetPosition(ChartControl);

      for (int i = 0; i < ChartControl.ChartPanels.Count; i++)
      {
      var panel = ChartControl.ChartPanels[i];
      if (panel == chartPanel)
      {
      double panelLeft = chartPanel.X;
      double panelTop = chartPanel.Y;
      double panelRight = panelLeft + chartPanel.W;
      double panelBottom = panelTop + chartPanel.H;
      Print("mouseDown " + mouseDown);
      Print("mousePosition " + mousePosition);
      Print("panelLeft " + panelLeft);
      Print("panelRight " + panelRight);
      Print("panelTop " + panelTop);
      Print("panelBottom " + panelBottom);
      break;
      }
      }​.....
      ​Am I leaving something out? any reference using to dpi?
      Attached Files

      Comment


        #4
        Hi RubenCazorla,

        ninZa.co has an indicator called "Smart Data Box" that can do this.

        Smart Data Box Indicator For NinjaTrader 8 - ninZa.co


        For more details, don't hesitate to get in touch with the support team: https://ninza.co/contact

        Regards,
        William
        ninZa
        NinjaTrader Ecosystem Vendor - ninZa.co

        Comment


          #5
          Originally posted by ninZa View Post
          Hi RubenCazorla,

          ninZa.co has an indicator called "Smart Data Box" that can do this.

          Smart Data Box Indicator For NinjaTrader 8 - ninZa.co


          For more details, don't hesitate to get in touch with the support team: https://ninza.co/contact

          Regards,
          William
          I'm sorry but it's not what I'm looking for, nor do I know how this can help me with the problem I'm referring to.

          Comment


            #6
            Hello RubenCazorla,

            You used different code in both of the events, do you still see a problem is you instead use the same code in both methods?
            JesseNinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by Pabulon, Today, 12:40 PM
            1 response
            9 views
            0 likes
            Last Post NinjaTrader_Gaby  
            Started by kazbek966, Today, 12:25 PM
            1 response
            9 views
            0 likes
            Last Post NinjaTrader_Jesse  
            Started by jeb1000, Yesterday, 02:36 PM
            8 responses
            21 views
            0 likes
            Last Post jeb1000
            by jeb1000
             
            Started by vp2199.cqg, Today, 12:28 PM
            0 responses
            5 views
            0 likes
            Last Post vp2199.cqg  
            Started by kazbek966, Today, 12:14 PM
            2 responses
            10 views
            0 likes
            Last Post kazbek966  
            Working...
            X