![]() |
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
|
|||||||
| General Programming General NinjaScript programming questions. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Senior Member
Join Date: Nov 2007
Location: Arlington Heights, IL
Posts: 100
Thanks: 0
Thanked 4 times in 4 posts
|
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 |
|
NinjaTrader Customer Service
Join Date: Sep 2008
Location: Germany
Posts: 22,416
Thanks: 252
Thanked 978 times in 961 posts
|
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.
Bertrand
NinjaTrader Customer Service |
|
|
|
|
|
#3 |
|
Senior Member
Join Date: Nov 2007
Location: Arlington Heights, IL
Posts: 100
Thanks: 0
Thanked 4 times in 4 posts
|
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.
|
|
|
|
|
|
#4 |
|
Junior Member
Join Date: Jun 2012
Posts: 2
Thanks: 0
Thanked 1 time in 1 post
|
Gary, many thanks!!!!
|
|
|
|
|
|
#5 |
|
Senior Member
Join Date: Nov 2007
Location: Arlington Heights, IL
Posts: 100
Thanks: 0
Thanked 4 times in 4 posts
|
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 |
|
|
|
|
|
#6 |
|
Member
Join Date: Jan 2009
Posts: 94
Thanks: 0
Thanked 14 times in 12 posts
|
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. |
|
|
|
|
The following user says thank you to borland for this post: |
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|
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 |