Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Can you limit selection of colors for a user input?

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

    Can you limit selection of colors for a user input?

    Howdy.

    Shown below is scaffolding for the declaration of a variable and collecting modifications to it via user input. The User input will be a drop-down of ALL available colors. Is it possible to limit the selection of colors to a specific set of colors, say 3?

    In the way you can limit a numerical input with the RangeAttribute?

    Specifically, can I do this WITHOUT creating my own custom enums to represent the desired colors I want to have as user inputs?

    Thanks,
    FP

    Code:
    public class LTvwapOverlay2 : Indicator
    {
    ...​
      private System.Windows.Media.Brush wClr_SP2 = Brushes.Red;
    
    
    ....
    
    #region properties
    [XmlIgnore]
    [Display(ResourceType = typeof(Custom.Resource), Name = "Color of SD+2", Description = "", GroupName = "1) Weekly", Order = 6)]
    public System.Windows.Media.Brush WClr_SP2
    {
       get {return wClr_SP2;}
       set {wClr_SP2 = value;}
    }
    [Browsable(false)]
    public string WClr_SP2Serializable
    {
       get { return Serialize.BrushToString(wClr_SP2); }
       set { wClr_SP2 = Serialize.StringToBrush(value); }
    }​
    .....
    Last edited by forrestang; 06-22-2024, 11:34 AM.

    #2
    One other question about the UI grid.

    Attached is an image. It's not a large deal, I'm just wondering if it is possible to NEST various user inputs, inside other ones... just for the way it is displayed on the UI screen.

    I've tried to give an idea of what I mean. You can see the top variable, is a bool. I'm wondering if I could somehow NEST other variables in that, that may remain collapsed, as these are things I'll change less frequently. NOTE, there will be MANY in my UI grid.

    I think a similar functionality can be seen when adding a SimpleFont to the UI grid, it captures all the text UI things, but is in a neat little grid within the text-type field(attached in image).

    If it is possible, it wasn't obvious to me from the Attributes section. Just checking to see if there is a way to customize the UI grid a bit?

    Thanks,
    FP

    Attached Files

    Comment


      #3
      Hello forrestang,

      I would only suggest creating an enum with a list of acceptable colors. I'm not aware of a way to remove standard brushes from a type.

      Generally we would advise to use a distinct GroupName in the Display attribute which will group those inputs together and be collapsable.

      However, below is a link to an example of an expandable class property.
      Chelsea B.NinjaTrader Customer Service

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Geovanny Suaza, 02-11-2026, 06:32 PM
      0 responses
      599 views
      0 likes
      Last Post Geovanny Suaza  
      Started by Geovanny Suaza, 02-11-2026, 05:51 PM
      0 responses
      345 views
      1 like
      Last Post Geovanny Suaza  
      Started by Mindset, 02-09-2026, 11:44 AM
      0 responses
      103 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by Geovanny Suaza, 02-02-2026, 12:30 PM
      0 responses
      558 views
      1 like
      Last Post Geovanny Suaza  
      Started by RFrosty, 01-28-2026, 06:49 PM
      0 responses
      558 views
      1 like
      Last Post RFrosty
      by RFrosty
       
      Working...
      X