Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Disable Quick time period change dialog

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

    Disable Quick time period change dialog

    I have a textbox in my Mainmenu, when I enter text in that area, the quick time period change dialog pops up and I can't edit my textbox.

    Ninjatrader Matt showed me some code here:
    http://ninjatrader.com/support/forum...678#post422678

    however, I want to be able to press delete / backspace and have it function like a normal textbox. I'm using the following code right now as a workaround, but i can only append text to the end. What is the proper way to accomplish this?

    Code:
    private void TextBox_PreviewKeyDown(object sender, KeyEventArgs e)
    		{
    			
    			TextBox textBoxSender = (TextBox) sender;
    			if(e.Key >= Key.D0 && e.Key <= Key.D9 || (e.Key >= Key.NumPad0 && e.Key <= Key.NumPad9)) { 
    				string s = e.Key.ToString();
    				textBoxSender.Text += s.Substring(s.Length-1,1);
    			// handle the keydown event for the text box
    			e.Handled = true;
    			}
    			
    			
    			
    		}

    #2
    Hello habibalex,

    Thank you for your post.

    So I may understand what you are looking for in the end, can you answer the following?
    Do you need the text box inside of the chart and panel? Can it it be a "window" outside of chart?
    Are Delete and Backspace the only functions you would need inside the text box?

    Comment


      #3
      I need the textbox on the MainMenu of the chart because I'm changing values.
      Delete and backspace are the only functions I need.

      I would just expect that I can edit the textbox like a normal textbox since I am inside that textbox, not the main chart window.

      Comment


        #4
        Hello habibalex,

        Thank you for your patience.

        Attached is an example of a text box added to the toolbar that will preview the key down and allow for functions like Backspace, Delete, Left and Right to work.

        Please let me know if you have any questions.
        Attached Files

        Comment


          #5
          in case someone wants to use this in the future, it doesn't work well. It still only appends to the end of the string and pressing shift left / right arrow does nothing. You also need to add the code from my first post to get numbers and then handle the decimal key separately. Either way its a real pain to enter stuff into textboxes in NT8. If you have an idea of the kind of values you need to enter, just capture mouse wheel events and scroll thru them


          Code:
          private void button_MouseWheel(object s, MouseWheelEventArgs e)
                  {
                      TextBox b = (TextBox)s;
                      int val = Convert.ToInt32(b.Text);
          			int factor = 100;
          			if((Keyboard.Modifiers & ModifierKeys.Control) > 0) factor = 1;
                      val += (int)Math.Round( e.Delta / 120.0)*factor;
          			val = Math.Max(0,val);
                      b.Text = val.ToString();
                  }

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by WaveAtElliot, Today, 05:11 PM
          1 response
          10 views
          1 like
          Last Post hdge4u
          by hdge4u
           
          Started by bosajin, Yesterday, 09:15 AM
          5 responses
          37 views
          0 likes
          Last Post NinjaTrader_Jim  
          Started by Dolfan, Today, 12:24 PM
          4 responses
          23 views
          0 likes
          Last Post NinjaTrader_Jim  
          Started by WeyldFalcon, Today, 11:09 AM
          7 responses
          26 views
          0 likes
          Last Post WeyldFalcon  
          Started by DTSSTS, 08-10-2020, 09:48 AM
          12 responses
          69 views
          0 likes
          Last Post DTSSTS
          by DTSSTS
           
          Working...
          X