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 CortexZenUSA, Today, 12:53 AM
      0 responses
      1 view
      0 likes
      Last Post CortexZenUSA  
      Started by CortexZenUSA, Today, 12:46 AM
      0 responses
      1 view
      0 likes
      Last Post CortexZenUSA  
      Started by usazencortex, Today, 12:43 AM
      0 responses
      5 views
      0 likes
      Last Post usazencortex  
      Started by sidlercom80, 10-28-2023, 08:49 AM
      168 responses
      2,265 views
      0 likes
      Last Post sidlercom80  
      Started by Barry Milan, Yesterday, 10:35 PM
      3 responses
      11 views
      0 likes
      Last Post NinjaTrader_Manfred  
      Working...
      X