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 pvincent, 06-23-2022, 12:53 PM
      14 responses
      238 views
      0 likes
      Last Post Nyman
      by Nyman
       
      Started by TraderG23, 12-08-2023, 07:56 AM
      9 responses
      382 views
      1 like
      Last Post Gavini
      by Gavini
       
      Started by oviejo, Today, 12:28 AM
      0 responses
      1 view
      0 likes
      Last Post oviejo
      by oviejo
       
      Started by pechtri, 06-22-2023, 02:31 AM
      10 responses
      125 views
      0 likes
      Last Post Leeroy_Jenkins  
      Started by judysamnt7, 03-13-2023, 09:11 AM
      4 responses
      59 views
      0 likes
      Last Post DynamicTest  
      Working...
      X