My question is related to your post
https://ninjatrader.com/support/foru...973#post685973
But the thread was closed.
I have a problem with 2 PreviewKeyDown methods.
On_quantitySelector_PreviewKeyDown()
ChartControl_PreviewKeyDown()
the 1st method executes an action to move the focus out of the QuantitySelector TextBox (after new size input, AND it requires the cursor to be in focus inside the QS Textbox to work and move the focus on the Chart Window).
The 2nd method executes a regular BuyMar****der (BUT it needs as for the 1st method for the cursor to be in focus BUT THIS TIME on the Chart Window to work and enter the BuyMar****rder).
My goal would be to combine the 2 methods by calling them 1 after the other with a 200ms pause inbetween.
But the problem is with the focus.
I thought of (untested yet) calling the 2 methods inside a 3rd method, but the issue would be to use what PreviewkeyDown method?
It seems if I select On_quantitySelector_PreviewKeyDown() for the 3rd method as
On_quantitySelector_PreviewKeyDown() // method 3
{
On_quantitySelector_PreviewKeyDown() // method 1
wait 200ms
ChartControl_PreviewKeyDown() // method 2
}
it would only execute the 1st method because the 2nd requires the focus on the Chart AND also a ChartControl_PreviewKeyDown method as calling method (the 3rd method seems requiring to be both of the 1st and 3rd type for it to work for the focus and for the calling).
The flow would be:
0. Focus in the Qs TextBox ->
1. user Presses the E Key ->
- the 3rd method (a second On_quantitySelector_PreviewKeyDown() one) calls the 1st method and does executes the focus move out of the QS TextBox
- With focus now on the Chart, method 3 calls method 2 which should work since the focus is the correct one, but doesn't work since the calling method (method 3) is of type On_quantitySelector_PreviewKeyDown() which only works if the focus is inside the QS TextBox.
Vice-versa problem if I select the 2nd method as 3rd method type.
What alternative workaround would you think of? Thanks!
Comment