Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

[Request] - ChartTrader access

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

    #16
    We'd recommend using an AddOn, otherwise you could find yourself throwing off internal operations.
    MatthewNinjaTrader Product Management

    Comment


      #17
      I've changed the Button.Click event to a Button.MouseDown event.. Seems the middle and right button events work.. But NOT the MouseButton.Left. The same thing occurs no matter how or where you use the button.. Could you please check this please.


      Attached Files
      -=Edge=-
      NinjaTrader Ecosystem Vendor - High Tech Trading Analysis

      Comment


        #18
        Originally posted by -=Edge=- View Post
        I've changed the Button.Click event to a Button.MouseDown event.. Seems the middle and right button events work.. But NOT the MouseButton.Left. The same thing occurs no matter how or where you use the button.. Could you please check this please.
        Did this get lost or forgot about? I'm specifically asking why the left click doesn't work (middle and right do) when creating a button.MouseDown event..

        Code:
         [COLOR=#0000ff]private[/COLOR] [COLOR=#0000ff]void[/COLOR] [COLOR=#080808]SampleButton_MDClick[/COLOR]([COLOR=#0000ff]object[/COLOR] [COLOR=#080808]sender[/COLOR], [COLOR=#080808]MouseButtonEventArgs[/COLOR] [COLOR=#080808]e[/COLOR])
         {
        [COLOR=#008000]     /////////////[/COLOR][COLOR=#008000]   Left Button Click Is NOT Working!!!! [/COLOR][COLOR=#008000]///////////////////////
        [/COLOR][COLOR=#0000ff]     if[/COLOR]([COLOR=#080808]e[/COLOR].[COLOR=#080808]ChangedButton[/COLOR] == [COLOR=#080808]MouseButton[/COLOR].[COLOR=#080808]Left[/COLOR] && [COLOR=#080808]e[/COLOR].[COLOR=#080808]ButtonState [/COLOR]== [COLOR=#080808]MouseButtonState[/COLOR].[COLOR=#080808]Pressed[/COLOR]) 
              {
         [COLOR=#080808]          Print[/COLOR]([COLOR=#b22222]"CT Left Button is working"[/COLOR]);
              }
         
         [COLOR=#0000ff]     if[/COLOR]([COLOR=#080808]e[/COLOR].[COLOR=#080808]ChangedButton[/COLOR] == [COLOR=#080808]MouseButton[/COLOR].[COLOR=#080808]Right[/COLOR] && [COLOR=#080808]e[/COLOR].[COLOR=#080808]ButtonState[/COLOR] == [COLOR=#080808]MouseButtonState[/COLOR].[COLOR=#080808]Pressed[/COLOR]) 
              {
         [COLOR=#080808]          Print[/COLOR]([COLOR=#b22222]"CT Right Button is working"[/COLOR]);
              }
         
         [COLOR=#0000ff]     if[/COLOR]([COLOR=#080808]e[/COLOR].[COLOR=#080808]ChangedButton[/COLOR] == [COLOR=#080808]MouseButton[/COLOR].[COLOR=#080808]Middle[/COLOR] && [COLOR=#080808]e[/COLOR].[COLOR=#080808]ButtonState[/COLOR] == [COLOR=#080808]MouseButtonState[/COLOR].[COLOR=#080808]Pressed[/COLOR])
              {
         [COLOR=#080808]          Print[/COLOR]([COLOR=#b22222]"CT Middle Button is working"[/COLOR]);
              }
         }
        -=Edge=-
        NinjaTrader Ecosystem Vendor - High Tech Trading Analysis

        Comment


          #19
          Based on what I'm seeing, it seems that the left mouse down event is suppressed within Button.MouseDown. I was able to modify your code by adding a second event handler, PreviewMouseLeftButtonDown, which captured only the left click:

          Code:
          sampleButton.PreviewMouseLeftButtonDown += SampleButton_LeftClick;
                                 
          sampleButton.MouseDown += SampleButton_MDClick;
          
                  private void SampleButton_LeftClick(object sender, MouseButtonEventArgs e)
                  {
                      Print("CT Left Button is working");
                  }
          
          		private void SampleButton_MDClick(object sender, MouseButtonEventArgs e)
          		{	
          			if(e.ChangedButton == MouseButton.Right && e.ButtonState == MouseButtonState.Pressed) 
          			{
          				Print("CT Right Button is working");
          			}
          			
          	        if(e.ChangedButton == MouseButton.Middle && e.ButtonState == MouseButtonState.Pressed)
          	        {
          				Print("CT Middle Button is working");
          		}
          		}
          Dave I.NinjaTrader Product Management

          Comment


            #20
            Originally posted by NinjaTrader_Dave View Post
            Based on what I'm seeing, it seems that the left mouse down event is suppressed within Button.MouseDown. I was able to modify your code by adding a second event handler, PreviewMouseLeftButtonDown, which captured only the left click:
            Adding a second handler for several dozen buttons would not be very efficient.. But since I now know that the left mouse down is being suppressed and not a bug, just changing the MouseDown to PreviewMouseDown seems to work fine as one handler for all 3 buttons.

            Thanks


            -=Edge=-
            NinjaTrader Ecosystem Vendor - High Tech Trading Analysis

            Comment


              #21
              Originally posted by NinjaTrader_Matthew View Post
              The menu item was moving to another visual tree when collapsed. This scenario will be fixed in B3 where the extension method has been updated to find the menu item if it is collapsed.
              This was a response to post #12 and was fixed in B3-B5... In B6 this seems to be broke again..


              -=Edge=-
              NinjaTrader Ecosystem Vendor - High Tech Trading Analysis

              Comment


                #22
                Quote:
                Originally Posted by NinjaTrader_Matthew
                The menu item was moving to another visual tree when collapsed. This scenario will be fixed in B3 where the extension method has been updated to find the menu item if it is collapsed.

                Originally posted by -=Edge=- View Post
                This was a response to post #12 and was fixed in B3-B5... In B6 this seems to be broke again..

                Can this be confirmed that this somehow got broke in B6?


                -=Edge=-
                NinjaTrader Ecosystem Vendor - High Tech Trading Analysis

                Comment


                  #23
                  No, I cannot reproduce based on the scenario in that post.

                  To test, I amended the indicator posted in #12 with the new chart trader automation id, "ChartWindowChartTraderControl" and I do not get any error sand works regardless of how the buttons are displayed.

                  Exactly where in the script is this logic breaking for you in B6?
                  Attached Files
                  MatthewNinjaTrader Product Management

                  Comment


                    #24
                    Originally posted by NinjaTrader_Matthew View Post
                    No, I cannot reproduce based on the scenario in that post. To test, I amended the indicator posted in #12 with the new chart trader automation id, "ChartWindowChartTraderControl" and I do not get any error sand works regardless of how the buttons are displayed.

                    Exactly where in the script is this logic breaking for you in B6?
                    I guess I should have been a bit more specific.. Yes, this example works fine.. and all the menuitems seem to work fine.. Try casting "ChartWindowPropertiesButton" or any of the other buttons and I get the null reference when they are not visible in the toolbar..




                    Edit: Not Visible
                    Last edited by -=Edge=-; 11-05-2015, 08:23 AM.
                    -=Edge=-
                    NinjaTrader Ecosystem Vendor - High Tech Trading Analysis

                    Comment


                      #25
                      Originally posted by NinjaTrader_Matthew View Post
                      No, I cannot reproduce based on the scenario in that post. Exactly where in the script is this logic breaking for you in B6?
                      Please Test This..

                      Initially load this sample script with all toolbar items visible and an output window open.. Then do reload ninjascript couple times.. All is well.. (No Printed Output)

                      Now reduce the size of your chart horizontally so that the properties button is no longer visible and reload ninjascript again. The button now comes back null..

                      Although the menu items seem to all work fine when in the overflow, any/all of the buttons come back null.. Is this a bug, or am I possibly doing something wrong?


                      Attached Files
                      -=Edge=-
                      NinjaTrader Ecosystem Vendor - High Tech Trading Analysis

                      Comment


                        #26
                        Hello,

                        I just wanted to provide an update on this thread.

                        We were able to see this on our end as well and are currently looking into the cause.

                        I look forward to being of further assistance.
                        JesseNinjaTrader Customer Service

                        Comment


                          #27
                          Just tryied to apply some code from that thread and looks like version 8.0.0.9 64-bit I have installed turns to be unresponsive when it rich the line
                          Code:
                          chartTrader = Window.GetWindow(ChartControl.Parent).FindFirst("ChartWindowChartTrader") as ChartTrader;
                          To be more correct the chart becomes unresponsive at all and the only way to close it is to kill the ninjatrader process in the task manager.
                          Does anybody use that? Does it work for you?

                          Comment


                            #28
                            Hello,

                            Thank you for the question.

                            Is there further context to this single line or mainly is a Dispatcher being used? If so are you using BeginInvoke or Invoke? There have been changes recently that may cause a "deadlock" when Invoke is used instead of BeginInvoke. Could you check that this is not the case?

                            I see in the prior sample provided Invoke is used, so that would need to change to BeginInvoke to prevent this from occurring.

                            I look forward to being of further assistance.
                            JesseNinjaTrader Customer Service

                            Comment


                              #29
                              Hi Jesse,

                              Thank you for your help. It was Invoke and changing it to BeginInvoke resolved the issue with deadlocking. But now chartTrader is always null. Probably Automation ID is no longer ChartWindowChartTrader. Not sure how to find out that.
                              I know that I am on unsupported area so will be greatful for any help or advise!
                              P.S. I have attached the sample I used
                              Attached Files

                              Comment


                                #30
                                Hello,

                                It looks like you are missing the word "Control" from the string, it would be:
                                ChartWindowChartTraderControl
                                It appears the thread has had the incorrect automation id posted, but in the prior example on post #23 it seems to be correct.

                                Please use:

                                Code:
                                chartTrader = Window.GetWindow(ChartControl.Parent).FindFirst("ChartWindowChartTraderControl") as ChartTrader;
                                As a side note, if you are curious on how to find automation ids, there is a tool but unfortunately it requires that the windows 8.1 sdk be installed which is rather large.

                                Learn how to use Inspect, a Windows-based tool that can select any UI element and view its accessibility data.


                                I look forward to being of further assistance.
                                JesseNinjaTrader Customer Service

                                Comment

                                Latest Posts

                                Collapse

                                Topics Statistics Last Post
                                Started by Kaledus, Today, 01:29 PM
                                5 responses
                                12 views
                                0 likes
                                Last Post NinjaTrader_Jesse  
                                Started by Waxavi, Today, 02:00 AM
                                1 response
                                8 views
                                0 likes
                                Last Post NinjaTrader_LuisH  
                                Started by alifarahani, Today, 09:40 AM
                                5 responses
                                23 views
                                0 likes
                                Last Post NinjaTrader_Jesse  
                                Started by gentlebenthebear, Today, 01:30 AM
                                3 responses
                                16 views
                                0 likes
                                Last Post NinjaTrader_Jesse  
                                Started by PhillT, Today, 02:16 PM
                                2 responses
                                7 views
                                0 likes
                                Last Post PhillT
                                by PhillT
                                 
                                Working...
                                X