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

UI properties in a Class

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

    UI properties in a Class

    Is it possible to put UI properties in a Class so as to reduce the amount of code needed when you have a lot of controls? I've attached a simple example with a class that has 1 UI control and then I've created two instances of the class. However, the controls do not show on the UI. I am fairly new to C# so I am guessing this is user error/lack of understanding. Thanks in advance for the help.
    Attached Files

    #2
    Hello swcooke,

    If you wanted to group properties in a class you can certainly do that.

    To have it displayed in the user interface would also require that you make a public property.

    Right now you have a List<S> which you have not provided a modifier for. If you don't specify, it's going to just be private by default. Also, a list would need a collection editor to be displayed which brings up the question, Do you want a list of items or an object with many properties or both?

    Starting with the most simple is the class as that would be the basis for any of the mentioned approaches. You can find an example of an expandable class object here: https://ninjatrader.com/support/foru...179#post510179

    For more complex scenarios where you do actually need a collection or to do other modifications, see the following post:


    You can further combine these items together to make complex property grids for the user interface, but please keep in mind that this may display differently in different tools. With that in mind, please make sure to test all situations the script is used in to confirm your logic works as expected and throws no errors.

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

    Comment


      #3
      Hi swcooke,

      Yes, it is possible. That's the idea behind expandable properties. It is a bit tricky to implement in that you'll have to write your own ICustomTypeDescriptor interface to modify the property grid.Unless you really need it, don't do it.
      Attached Files

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by usazencort, Today, 01:16 AM
      0 responses
      1 view
      0 likes
      Last Post usazencort  
      Started by kaywai, 09-01-2023, 08:44 PM
      5 responses
      603 views
      0 likes
      Last Post NinjaTrader_Jason  
      Started by xiinteractive, 04-09-2024, 08:08 AM
      6 responses
      22 views
      0 likes
      Last Post xiinteractive  
      Started by Pattontje, Yesterday, 02:10 PM
      2 responses
      21 views
      0 likes
      Last Post Pattontje  
      Started by flybuzz, 04-21-2024, 04:07 PM
      17 responses
      230 views
      0 likes
      Last Post TradingLoss  
      Working...
      X