Announcement

Collapse
No announcement yet.

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 Geovanny Suaza, 02-11-2026, 06:32 PM
    0 responses
    647 views
    0 likes
    Last Post Geovanny Suaza  
    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
    0 responses
    369 views
    1 like
    Last Post Geovanny Suaza  
    Started by Mindset, 02-09-2026, 11:44 AM
    0 responses
    108 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by Geovanny Suaza, 02-02-2026, 12:30 PM
    0 responses
    572 views
    1 like
    Last Post Geovanny Suaza  
    Started by RFrosty, 01-28-2026, 06:49 PM
    0 responses
    573 views
    1 like
    Last Post RFrosty
    by RFrosty
     
    Working...
    X