Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Any way to add dynamic(variable) inputs?

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

    Any way to add dynamic(variable) inputs?

    HI.
    at this moment, I always declare the inputs with fixed blocks, like:

    Code:
    	[Category("xyz")]
            [Display(Name = "InutName abc", Order = 1)]
            public bool Enable_Smth_1
            {
                get { return enable_smth[1]; }	set { enable_smth[1] = value; }
            }

    is it somehow possible to create the dynamic number of inputs, like:
    Code:
    for(var i=0; i<4; i++){
    
    	[Category("xyz"+i)]
            [Display(Name = "InutName abc"+i, Order = i)]
            public bool "Enable_Smth"+i
            {
                get { return enable_smth[i]; }	set { enable_smth[i] = value; }
            }
    
    }

    #2
    Hello,

    Thank you for the post.

    You could explore using Collections such as an Array if the user needs to input multiple choices. There is a sample here that contains a list of elements as a property: https://ninjatrader.com/support/foru...ad.php?t=97919

    Otherwise, I am unaware of a way to have any sort of looping logic like this outside of the method level in the class scope. There would not be anything I could personally suggest to make adding of properties more dynamic like you have shown. If any other users have explored this concept, they could certainly provide their solutions here.


    I look forward to being of further assistance.

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by argusthome, Yesterday, 10:06 AM
    0 responses
    14 views
    0 likes
    Last Post argusthome  
    Started by NabilKhattabi, 03-06-2026, 11:18 AM
    0 responses
    11 views
    0 likes
    Last Post NabilKhattabi  
    Started by Deep42, 03-06-2026, 12:28 AM
    0 responses
    8 views
    0 likes
    Last Post Deep42
    by Deep42
     
    Started by TheRealMorford, 03-05-2026, 06:15 PM
    0 responses
    4 views
    0 likes
    Last Post TheRealMorford  
    Started by Mindset, 02-28-2026, 06:16 AM
    0 responses
    31 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Working...
    X