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!
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
NinjaTrader
UI properties in a Class
Collapse
X
-
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. -
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
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by pmachiraju, 11-01-2023, 04:46 AM
|
8 responses
147 views
0 likes
|
Last Post
by rehmans
Today, 06:44 PM
|
||
Started by mattbsea, Today, 05:44 PM
|
0 responses
5 views
0 likes
|
Last Post
by mattbsea
Today, 05:44 PM
|
||
Started by RideMe, 04-07-2024, 04:54 PM
|
6 responses
33 views
0 likes
|
Last Post
by RideMe
Today, 05:31 PM
|
||
Started by tkaboris, Today, 05:13 PM
|
0 responses
5 views
0 likes
|
Last Post
by tkaboris
Today, 05:13 PM
|
||
Started by GussJ, 03-04-2020, 03:11 PM
|
16 responses
3,282 views
0 likes
|
Last Post
by Leafcutter
Today, 04:14 PM
|
Comment