• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Select folder or file via property grid

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

    Select folder or file via property grid

    Is there (or has anyone developed) a way to have a property that is a folder name or file name that can be chosen from the property grid by invoking the folder or file chooser dialog?

    For example, on the grid, I select a property called, say, "Folder for trade records" and it pops up the folder chooser dialog.

    Thanks for any assistance.

    #2
    Originally posted by jeronymite View Post
    Is there (or has anyone developed) a way to have a property that is a folder name or file name that can be chosen from the property grid by invoking the folder or file chooser dialog?

    For example, on the grid, I select a property called, say, "Folder for trade records" and it pops up the folder chooser dialog.

    Thanks for any assistance.
    Read this entire thread: the answer is in there. It is not a matter of what the thread is called: it is what it contains.

    ref: http://www.ninjatrader.com/support/f...d.php?p=243127

    Comment


      #3
      Hello jeronymite,

      Thank you for your post.

      koganam provide a link to a thread in which this it was discussed, you can find his code example on this item at the following link: http://www.ninjatrader.com/support/f...40&postcount=9

      This is outside the bounds of NinjaScript but is something that is possible through C# programming which NinjaScript is based on.
      Patrick H.NinjaTrader Customer Service

      Comment


        #4
        Many thanks, koganam!

        The revealing of hitherto undiscovered functionality is always exciting.

        I have implemented the code as follows:
        private string SaveFilename ;

        [Description("File to save"]
        [GridCategory("Parameters (File Information)")]
        [Gui.Design.DisplayName ("Name of old File")]
        [EditorAttribute(typeof(System.Windows.Forms.Design .FileNameEditor), typeof(System.Drawing.Design.UITypeEditor))]
        public string _SaveFilename
        {
        get { return SaveFilename ; }
        set { SaveFilename = value ; }
        }
        I have added a reference to:
        C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\ System.Design.dll
        I note that the version of .NET is v4.5, but the file is there, so I chose the latest version of .NET. The strategy compiles without issue.

        When I add the strategy and edit the parameters, I do not see the relevant entry in the grid, although other parameters in the same grid area are there.

        Despite that, I enable the strategy and then get a popup that says:
        Failed to execute DB job 'StrategyUpdateJob': There was an error reflecting type 'NinjaTrader.Strategy.MyStrategy'.: AssemblyResolveEvent handlers cannot return Assemblies loaded for reflection only.
        ... where MyStrategy is the name of my strategy.

        Any further advice most welcome!

        Comment


          #5
          Originally posted by jeronymite View Post
          Many thanks, koganam!

          The revealing of hitherto undiscovered functionality is always exciting.

          I have implemented the code as follows:
          private string SaveFilename ;

          [Description("File to save"]
          [GridCategory("Parameters (File Information)")]
          [Gui.Design.DisplayName ("Name of old File")]
          [EditorAttribute(typeof(System.Windows.Forms.Design .FileNameEditor), typeof(System.Drawing.Design.UITypeEditor))]
          public string _SaveFilename
          {
          get { return SaveFilename ; }
          set { SaveFilename = value ; }
          }
          I have added a reference to:
          C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\ System.Design.dll
          I note that the version of .NET is v4.5, but the file is there, so I chose the latest version of .NET. The strategy compiles without issue.

          When I add the strategy and edit the parameters, I do not see the relevant entry in the grid, although other parameters in the same grid area are there.

          Despite that, I enable the strategy and then get a popup that says:
          Failed to execute DB job 'StrategyUpdateJob': There was an error reflecting type 'NinjaTrader.Strategy.MyStrategy'.: AssemblyResolveEvent handlers cannot return Assemblies loaded for reflection only.
          ... where MyStrategy is the name of my strategy.

          Any further advice most welcome!
          In the same thread is this post: www.ninjatrader.com/support/forum/showthread.php?p=243649

          You must use the correct .NET versioon.

          This statement is directly in the description notes in the code posted.
          /// Demo of how to create a FileSelection Dialog Box in properties. You must reference System.Design.dll from Microsoft.NET 2.0, or it will not compile.
          Last edited by koganam; 09-08-2013, 06:43 AM.

          Comment


            #6
            Thanks again, koganam.

            I installed .NET Framework 2.0 and changed the reference and it works as documented.

            It was indeed my mistake in thinking I could use the same dll from the most recent .Net Framework release.

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by mpower, 05-27-2011, 01:16 PM
            4 responses
            2,586 views
            0 likes
            Last Post nkhoi
            by nkhoi
             
            Started by brucerobinson, Today, 02:43 AM
            5 responses
            31 views
            0 likes
            Last Post brucerobinson  
            Started by 2Look4me, Today, 09:33 AM
            6 responses
            39 views
            0 likes
            Last Post NinjaTrader_PatrickH  
            Started by calebsandfort, Today, 02:11 PM
            2 responses
            10 views
            0 likes
            Last Post calebsandfort  
            Started by traderpards, Today, 02:16 PM
            1 response
            6 views
            0 likes
            Last Post NinjaTrader_Jim  
            Working...
            X