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

Folder Path Picker

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

    Folder Path Picker

    Use case: create a public variable in the Properties section so when the user clicks on the dialogue box in the indicator configuration window, they can navigate to a desired folder location, and this returns the full path of the folder they selected.​

    After conferring with NinjaTrader support, they confirmed there is no built-in class for a "folder picker" where the user navigates to a desired folder location, like there is for files, here: NinjaTrader.Gui.Tools.FilePathPicker.

    Online searches usually suggest using the FolderBrowserDialog Class in System.Windows.Forms.

    Has anyone had success doing this?

    NT support did say one could create a custom type converter for this, so if anyone has a full example (meaning where the typeConverter works within the Indicator Configuration UI), I would appreciate any help you might offer.


    Last edited by Jim-Boulder; 06-19-2023, 09:59 AM. Reason: revised wording for clarity
    Jim-Boulder
    NinjaTrader Ecosystem Vendor - Elephant Tracks

    #2

    Folder picker:
    Code:
        private void TextBox1_Picker(object sender, MouseButtonEventArgs e)
            {
                //https://forum.ninjatrader.com/forum/ninjatrader-8/add-on-development/1101848-nt-file-dialog-control
                NinjaTrader.Gui.Tools.LoadingDialog.LoadingDialog loadingDialog = new NinjaTrader.Gui.Tools.LoadingDialog.LoadingDialog()
                {
                    //Owner = ChartControl.Parent as Window,
                    //Owner = this,
                    //FileFilter = "xml Files (*.xml)|*.xml)",
                    //FileFilter = "All files (*.*)|*.*)",
                    Caption = "Folder location",
                    ActionButtonText = "Select",
                    Directory = @"f:\temp",
                    IsFullBrowsingAllowed = true,
                    IsFolderSelectOnly=true,
                    IsFolderSelectEnabled=true,
                    FileAction = FileAction.Open //Save or Open
                };
    
                bool? result = loadingDialog.ShowDialog();
                TextBox1.Text=loadingDialog.FileName;
            }
            ​



    File picker:
    Code:
        private void TextBox1_Picker(object sender, MouseButtonEventArgs e)
            {
                //https://forum.ninjatrader.com/forum/ninjatrader-8/add-on-development/1101848-nt-file-dialog-control
                NinjaTrader.Gui.Tools.LoadingDialog.LoadingDialog loadingDialog = new NinjaTrader.Gui.Tools.LoadingDialog.LoadingDialog()
                {
                    //Owner = ChartControl.Parent as Window,
                    //Owner = this,
                    //FileFilter = "xml Files (*.xml)|*.xml)",
                    FileFilter = "All files (*.*)|*.*)",
                    Caption = "File location",
                    ActionButtonText = "Select",
                    Directory = @"f:\temp",
                    IsFullBrowsingAllowed = true,
    //              IsFolderSelectOnly=true,
    //              IsFolderSelectEnabled=true,
                    FileAction = FileAction.Open //Save or Open
                };
    
                bool? result = loadingDialog.ShowDialog();
                TextBox1.Text=loadingDialog.FileName;
            }
            ​

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by fx.practic, 10-15-2013, 12:53 AM
    5 responses
    5,404 views
    0 likes
    Last Post Bidder
    by Bidder
     
    Started by Shai Samuel, 07-02-2022, 02:46 PM
    4 responses
    95 views
    0 likes
    Last Post Bidder
    by Bidder
     
    Started by DJ888, Yesterday, 10:57 PM
    0 responses
    8 views
    0 likes
    Last Post DJ888
    by DJ888
     
    Started by MacDad, 02-25-2024, 11:48 PM
    7 responses
    159 views
    0 likes
    Last Post loganjarosz123  
    Started by Belfortbucks, Yesterday, 09:29 PM
    0 responses
    8 views
    0 likes
    Last Post Belfortbucks  
    Working...
    X