Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

Making String Input Behave Like Regualr Text Object

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

    Making String Input Behave Like Regualr Text Object

    Hello,

    In the indicator, there's a user-defined string input. When pressing enter while editing the string, it closes the indicator window. The desired effect is to allow new lines within the string input. In NT's Text code, it uses the following (line 127).

    Code:
    [PropertyEditor("NinjaTrader.Gui.Tools.MultilineEditor")]
    This does work for when a single line is too long so it automatically goes to the next line, but that is only for styling. A solution would be to handle a Key.Enter KeyDownEvent, but I don't know how it should be implemented. In theory, there's a property that stores whether or not we are editing the string input field? If so, then set the KeyDownEvent to handled if it's being edited. This would override the one that closes the Indicators window.

    Thanks
    Unsuitable
    NinjaTrader Ecosystem Vendor - Ocean Trading Indicators

    #2
    Hello Unsuitable,

    To confirm, you want to detect the user has pressed enter, handle the event and return to prevent the window from closing, and then insert into the string a "\r\n" in place of the enter key?

    I don't think this will be possible. That I know of, NinjaScripts do not have the ability to assign event handlers in the properties window.

    I would recommend you have the user just type \r\n into the string.
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Hello,

      In essence, that's what I want to do, but not the \r\n part. I want it to be consistent with the regular editor of a text object, so pressing enter goes to a new line.



      Thanks
      Unsuitable
      NinjaTrader Ecosystem Vendor - Ocean Trading Indicators

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Brevo, Today, 01:45 AM
      0 responses
      3 views
      0 likes
      Last Post Brevo
      by Brevo
       
      Started by aussugardefender, Today, 01:07 AM
      0 responses
      3 views
      0 likes
      Last Post aussugardefender  
      Started by pvincent, 06-23-2022, 12:53 PM
      14 responses
      239 views
      0 likes
      Last Post Nyman
      by Nyman
       
      Started by TraderG23, 12-08-2023, 07:56 AM
      9 responses
      384 views
      1 like
      Last Post Gavini
      by Gavini
       
      Started by oviejo, Today, 12:28 AM
      0 responses
      6 views
      0 likes
      Last Post oviejo
      by oviejo
       
      Working...
      X