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

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.
    Multi-Dimensional Managed Trading
    jeronymite
    NinjaTrader Ecosystem Vendor - Mizpah Software

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

      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!
        Multi-Dimensional Managed Trading
        jeronymite
        NinjaTrader Ecosystem Vendor - Mizpah Software

        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, 07: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.
            Multi-Dimensional Managed Trading
            jeronymite
            NinjaTrader Ecosystem Vendor - Mizpah Software

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by martin70, 03-24-2023, 04:58 AM
            15 responses
            114 views
            0 likes
            Last Post NinjaTrader_Jesse  
            Started by The_Sec, Today, 02:29 PM
            1 response
            5 views
            0 likes
            Last Post NinjaTrader_Jesse  
            Started by jeronymite, 04-12-2024, 04:26 PM
            2 responses
            31 views
            0 likes
            Last Post NinjaTrader_BrandonH  
            Started by Mindset, 05-06-2023, 09:03 PM
            10 responses
            265 views
            0 likes
            Last Post NinjaTrader_BrandonH  
            Started by michi08, 10-05-2018, 09:31 AM
            5 responses
            743 views
            0 likes
            Last Post NinjaTrader_ChelseaB  
            Working...
            X