• 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

FileOpen dialog on indicator

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

    FileOpen dialog on indicator

    Ok, Guys,

    I searched whole forum and nobody has answer how to invoke FileOpen dialog to select Alert sound file in Ninja Indicator. However I own proprietary indicator that does exactly that (yes, it is compiled . Also it is absolutely clear that such functionality exists and Ninja developers knows about that. And it is clear that even this info closed || unsupported || whatever it leaked enough that people are using it, it is stable and products with such functionality are sold.

    So, let's be honest, how to do that?

    In addition - how to change plot names in Indicator options to normal words with spaces, not PlotCurrentT3AverageIfSM (instead "T3 average colour"). I saw this implemented too several times.

    Thank you,
    -Andrius.

    #2
    what you are asking is standard C# queries. google a bit and you will get the answer. anyway heres a nt code.

    Code:
    using System.Windows.Forms;
    Code:
    protected override void OnStartUp()
            {
                
                OpenFileDialog file = new OpenFileDialog();
                file.ShowDialog();
                
                string path;
                path = file.FileName;
                MessageBox.Show(path);
                
            }

    Comment


      #3
      Dear bukkan,

      I am aware about OpenFileDialog(); however I fail to understand how to fit it into Indicator's properties dialog under particular field. Please see screenshotted example what I am trying to achieve...

      Thank you,
      -Andrius.
      Attached Files

      Comment


        #4
        For some reason I can't download that JPEG to look at what you are trying to achieve.

        Off the top of my head an enum with a switch statement, say, UserSound that calls the OpenFileDialog if selected should do the trick.

        You might need to watch how you Dispose of things, though.

        Comment


          #5
          ahh the pic made things clear. still its a c# thing and googling will help more rather than searching here.

          heres a sample code

          in the variable region
          Code:
          string open;
          in properties
          Code:
          [Description("")]
                  [GridCategory("Parameters")]
                  [Editor(typeof(System.Windows.Forms.Design.FileNameEditor),
                    typeof(System.Drawing.Design.UITypeEditor))]
                  public string Open
                  {
                      get{return open;}
                      set{open = value;}
                  }

          Comment


            #6
            How about an equivilant for NT6.5? This would be nice!

            Buddy

            Comment


              #7
              Dear Buddy,

              the same code works for both NT6.5 and NT7. basically you override System.Windows.Forms.Design.FileNameEditor with something bukkan wrote.

              What about second part of my question - any ideas how to change description entry for particular plot? Any ideas how to hide plot style and color select dialog at all?

              Thank you,
              -Andrius.

              Comment


                #8
                The reason I didn't think it would work in 6.5 is because
                // FileNameEditor

                //Does not seem to be valid here

                [Editor(typeof(System.Windows.Forms.Design.FileNameEditor),
                typeof(System.Drawing.Design.UITypeEditor))]


                Then I tried the same in NT7 and found the same thing

                Comment


                  #9
                  Dear Buddy,

                  you need to add referrence to System.Design.dll file for this to complile. Depending on IDE you use this may vary... On Ninja editor just press right click and follow from there.

                  -Andrius.

                  Comment


                    #10
                    I have a similar problem.

                    I want to capture the input parameters for an indicator of a C # form. The call of the OnBarUpdate method should be avoided until the form is closed.

                    my idea is:

                    public class ParmsForm : Form
                    public ParmsForm ()
                    {
                    this.Text = "C# - einfaches Form";
                    this.Size = new Size(600, 400);

                    AddContextMenuAndItems();

                    addControls();

                    }
                    .... .... ....
                    I call the modal form from inside the OnStartup method:
                    protected override void OnStartUp()
                    {
                    ParmsForm parmsForm = new ParmsForm();
                    parmsForm.ShowDialog();
                    }
                    The form is displayed. However, the OnBarUpdate method is called before the form is closed. My parameters are thus in the indicator is still not known.

                    Does anyone provide any solution or idea?

                    Comment


                      #11
                      Do you really want to stop the NT tool? Don't know if that's a good idea. Why don't you use the property grid for input? It is guaranteed to provide its content before the indicator starts operating.
                      If the property grid gets to confusing because you need to input a lot of date, then you could develop something with the expansion functionality of the grid (this little + - signs). Especially, if you have a lot of date with a repetitive structure you could use the property expansion quite effectively.

                      Regards
                      Ralph

                      Comment


                        #12
                        Basically you're right. But In a WinForm, one could structure the input parameters a little bit better.

                        Comment


                          #13
                          Depending on your coding skills it would be possible to add something like a WinForm to the property grid. Advantage still is that you are conform with the rules how NT sets up an indicator. Here is the link to an example illustrating how that could be reached:
                          http://www.codeproject.com/KB/miscct...itorsDemo.aspx

                          Regards
                          Ralph

                          Comment


                            #14
                            What is the right way to do this?

                            Originally posted by andrius View Post
                            Dear Buddy,

                            you need to add referrence to System.Design.dll file for this to complile. Depending on IDE you use this may vary... On Ninja editor just press right click and follow from there.

                            -Andrius.
                            For my future reference, what is the easy way to do that (in the NT editor)?
                            • I presume you want just the DLL name so normal search rules are in effect.
                            • Entering the name in the "References... | Add..." dialog forces a fully qualified pathname -- I saw no way to avoid that
                            • I found a likely looking XML file (Config.xml) and edited that -- inserted between System.Core.dll and System.Drawing.dll, to preserve alphabetic order. (I can just see the NT support folks cringing ...)
                            • That worked, but only after stopping and restarting NT

                            I presume there is an easier way -- please enlighten me?

                            --EV
                            Last edited by ETFVoyageur; 01-03-2011, 09:05 PM.

                            Comment


                              #15
                              Originally posted by andrius View Post
                              What about second part of my question - any ideas how to change description entry for particular plot? Any ideas how to hide plot style and color select dialog at all?
                              -Andrius.
                              The name that shows for the plot, is set directly when you define the plot in the Initialize() method, thus:

                              Code:
                                
                              Add(new Plot(Color.Green, "This is the name that shows in the configuration GUI"));
                              You hide the plot configuration dialog using this line in the Initialize() method:

                              Code:
                              PlotsConfigurable = false;

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by maggie3, Today, 02:05 AM
                              0 responses
                              3 views
                              0 likes
                              Last Post maggie3
                              by maggie3
                               
                              Started by qewcool, Today, 01:14 AM
                              0 responses
                              3 views
                              0 likes
                              Last Post qewcool
                              by qewcool
                               
                              Started by fredrikn, 05-08-2019, 04:01 AM
                              17 responses
                              669 views
                              1 like
                              Last Post emtrader  
                              Started by zacharydw00, Yesterday, 10:19 PM
                              0 responses
                              3 views
                              0 likes
                              Last Post zacharydw00  
                              Started by chafan11, Yesterday, 09:28 PM
                              0 responses
                              7 views
                              0 likes
                              Last Post chafan11  
                              Working...
                              X