Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
[Request] - ChartTrader access
Collapse
X
-
Originally posted by -=Edge=- View PostI'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.
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]); } }
Comment
-
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
-
Originally posted by NinjaTrader_Dave View PostBased 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:
Thanks
Comment
-
Originally posted by NinjaTrader_Matthew View PostThe 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.
Comment
-
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 PostThis 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?
Comment
-
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 FilesMatthewNinjaTrader Product Management
Comment
-
Originally posted by NinjaTrader_Matthew View PostNo, 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?
Edit: Not VisibleLast edited by -=Edge=-; 11-05-2015, 08:23 AM.
Comment
-
Originally posted by NinjaTrader_Matthew View PostNo, I cannot reproduce based on the scenario in that post. Exactly where in the script is this logic breaking for you in B6?
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
Comment
-
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;
Does anybody use that? Does it work for you?
Comment
-
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
-
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 usedAttached Files
Comment
-
Hello,
It looks like you are missing the word "Control" from the string, it would be:ChartWindowChartTraderControl
Please use:
Code:chartTrader = Window.GetWindow(ChartControl.Parent).FindFirst("ChartWindowChartTraderControl") as ChartTrader;
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 carnitron, Today, 08:42 PM
|
0 responses
5 views
0 likes
|
Last Post
by carnitron
Today, 08:42 PM
|
||
Started by strategist007, Today, 07:51 PM
|
0 responses
6 views
0 likes
|
Last Post Today, 07:51 PM | ||
Started by StockTrader88, 03-06-2021, 08:58 AM
|
44 responses
3,974 views
3 likes
|
Last Post
by jhudas88
Today, 06:59 PM
|
||
Started by rbeckmann05, Today, 06:48 PM
|
0 responses
8 views
0 likes
|
Last Post
by rbeckmann05
Today, 06:48 PM
|
||
Started by rhyminkevin, Today, 04:58 PM
|
4 responses
58 views
0 likes
|
Last Post
by dp8282
Today, 06:13 PM
|
Comment