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

DropDown list for a property built from a file

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

    DropDown list for a property built from a file

    Can anybody point me to a code snipet or describe how to have a drop down list in the properties dialog? I am aware of enums but that will not work because I need the list of values to be derived from a file and built at runtime, not compile time.

    Thanks,
    Gary

    #2
    Sorry Gary, I would unfortunately not be aware of such an example - the enums sample is the only official bit we can offer in this area.
    BertrandNinjaTrader Customer Service

    Comment


      #3
      The following code seems to be in the right direction but I still need suggestions on how to:
      - Make content of ComboBox show up when user clicks on down arrow
      (currently shows empty list even though list has 2 items).

      - turn off display of full property list of the ComboBox
      (currently a plus sign shows up on left and expands into full property sheet of ComboBox)

      - Make input editable
      (currently typing into are is not being allowed)

      - Determine why a new instance of the ComboBox is created when sent back into the PropOne.set method.

      Unofficial help is welcome

      Thanks,
      Gary

      Here is the code:

      HTML Code:
      <code>
      #region Using declarations
      using System;
      using System.ComponentModel;
      using System.Diagnostics;
      using System.Drawing;
      using System.Drawing.Drawing2D;
      using System.Xml.Serialization;
      using NinjaTrader.Cbi;
      using NinjaTrader.Data;
      using NinjaTrader.Gui.Chart;
      using System.Windows.Forms;
      #endregion
      
      // This namespace holds all indicators and is required. Do not change it.
      namespace NinjaTrader.Indicator
      {
          /// <summary>
          /// Enter the description of your new custom indicator here
          /// </summary>
          [Description("Enter the description of your new custom indicator here")]
          public class GTestDropDown : Indicator
          {
      		private ComboBox propOneCB;
      
              protected override void Initialize()
              {
      			try
      			{
      				propOneCB = new ComboBox();
      				propOneCB.Items.Add("1");
      				propOneCB.Items.Add("2");
      			}
      			catch (Exception e)
      			{
      				Print("-----"+e.ToString());
      			}
                  Overlay				= false;
              }
      
              protected override void OnBarUpdate()
              {
              }
      
              [Description("")]
              [GridCategory("Parameters")]
              public ComboBox PropOne
              {
                  get { return propOneCB; }
                  set { Print("value="+value); }
              }
          }
      }
      </code>
      Last edited by GaryAlbers; 06-23-2012, 01:07 PM.

      Comment


        #4
        Gary, many thanks!!!!

        Comment


          #5
          sierikas,

          I'd like to say your welcome, but the code is incomplete.
          I cannot use it. Can you?
          If you have figured out a way to use it, let me know.

          -Gary

          Comment


            #6
            Gary,

            I haven't really looked over this stuff in detail, but it looks like you and others might find these links helpful.

            You mentioned you knew how to do DropDown Lists (ComboBox) by declaring enum's.. Snaphook uploaded this Indicator which does this..



            Got that from this NT forum thread



            Now back to the workaround for the enum problem, take a look at this thread

            I have a C# 3.0 WinForms application which is occasionally required to control Excel with automation. This is working nicely with normal early binding but I've had some problems when people don't h...


            And this .NET framework reference sample code at the bottom of the page..



            Hope that helps.

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by Brevo, Today, 01:45 AM
            0 responses
            6 views
            0 likes
            Last Post Brevo
            by Brevo
             
            Started by aussugardefender, Today, 01:07 AM
            0 responses
            3 views
            0 likes
            Last Post aussugardefender  
            Started by pvincent, 06-23-2022, 12:53 PM
            14 responses
            242 views
            0 likes
            Last Post Nyman
            by Nyman
             
            Started by TraderG23, 12-08-2023, 07:56 AM
            9 responses
            384 views
            1 like
            Last Post Gavini
            by Gavini
             
            Started by oviejo, Today, 12:28 AM
            0 responses
            6 views
            0 likes
            Last Post oviejo
            by oviejo
             
            Working...
            X