NinjaTrader Support Forum  
X

Attention!

This website will be down for maintenance from Friday May 24th at 6PM MDT until Saturday May 25th at 11AM MDT. We apologize for the inconvenience. If you need assistance during this time, please email sales@ninjatrader.com


Go Back   NinjaTrader Support Forum > NinjaScript Development Support > General Programming

General Programming General NinjaScript programming questions.

Reply
 
Thread Tools Display Modes
Old 06-18-2012, 06:53 PM   #1
GaryAlbers
Senior Member
 
Join Date: Nov 2007
Location: Arlington Heights, IL
Posts: 100
Thanks: 0
Thanked 4 times in 4 posts
Default 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
GaryAlbers is offline  
Reply With Quote
Old 06-19-2012, 01:55 AM   #2
NinjaTrader_Bertrand
NinjaTrader Customer Service
 
NinjaTrader_Bertrand's Avatar
 
Join Date: Sep 2008
Location: Germany
Posts: 22,407
Thanks: 252
Thanked 974 times in 957 posts
Default

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.
NinjaTrader_Bertrand is online now  
Reply With Quote
Old 06-20-2012, 04:46 PM   #3
GaryAlbers
Senior Member
 
Join Date: Nov 2007
Location: Arlington Heights, IL
Posts: 100
Thanks: 0
Thanked 4 times in 4 posts
Default

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 at 01:07 PM.
GaryAlbers is offline  
Reply With Quote
Old 06-24-2012, 06:14 PM   #4
sierikas
Junior Member
 
Join Date: Jun 2012
Posts: 2
Thanks: 0
Thanked 1 time in 1 post
Default

Gary, many thanks!!!!
sierikas is offline  
Reply With Quote
Old 06-24-2012, 08:20 PM   #5
GaryAlbers
Senior Member
 
Join Date: Nov 2007
Location: Arlington Heights, IL
Posts: 100
Thanks: 0
Thanked 4 times in 4 posts
Default

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
GaryAlbers is offline  
Reply With Quote
Old 06-25-2012, 11:27 AM   #6
borland
Member
 
Join Date: Jan 2009
Posts: 94
Thanks: 0
Thanked 14 times in 12 posts
Default

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..

http://www.ninjatrader.com/support/f...yid=62&doit=Go

Got that from this NT forum thread

http://www.ninjatrader.com/support/f...ead.php?t=5782

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

http://stackoverflow.com/questions/3...ing-in-c-sharp

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

http://msdn.microsoft.com/en-us/libr...mprovider.aspx

Hope that helps.
borland is offline  
Reply With Quote
The following user says thank you to borland for this post:
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Suggestion: DropDown combo with Intruments List In chart jatubio Suggestions And Feedback 3 05-06-2010 07:50 AM
Session Template Dropdown List is too Narrow aksamyo Version 7 Beta General Questions & Bug Reports 2 10-24-2009 05:27 AM
Change the order of items in the ATM dropdown list JS999 Suggestions And Feedback 1 08-21-2009 02:21 AM
IB is not in dropdown list ssg10 Connecting 5 01-23-2009 05:20 AM
Don't see TD Ameritrade in the dropdown list? walezw Connecting 4 09-12-2008 04:35 PM


All times are GMT -6. The time now is 02:55 AM.