• 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

Unsupported C# question...

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

    Unsupported C# question...

    I'm simply trying to open a Form within the chart clientarea. Somehow, this eludes me. I've tried all the examples I've found and none of them work. I'm missing something. I guess the child does not really know who the parent is. When I do fHelp.Show(this); It's receiving NinjaScript.Indicator and not System.Windows.Form; and throws an error. Any help would be greatly appreciated


    using System.Windows.Form;

    public class MyIndicator : Indicator
    {

    private Form fHelp;

    private void tsHelpBtn_Click(object sender, EventArgs e)
    {
    fHelp = new Form();
    fHelp.StartPosition = FormStartPosition.CenterParent;
    fHelp.Owner = (Form)ChartControl.Parent; // even tried that to no avail

    fHelp.Show();
    }

    }

    #2
    I'm looking at some code someone else did to compare. Sorry, I can't release it.

    But... the major difference I see is this person used is "this." in front of all like I demonstrate in your code.

    It's worth a shot. Other than that, I probably have no clue.


    Code:
    private void tsHelpBtn_Click(object sender, EventArgs e)
    {
    this.fHelp = new Form();
    this.fHelp.StartPosition = FormStartPosition.CenterParent;
    this.fHelp.Owner = (Form)ChartControl.Parent; // even tried that to no avail
    
    this.fHelp.Show();
    }
    Originally posted by funk101 View Post
    I'm simply trying to open a Form within the chart clientarea. Somehow, this eludes me. I've tried all the examples I've found and none of them work. I'm missing something. I guess the child does not really know who the parent is. When I do fHelp.Show(this); It's receiving NinjaScript.Indicator and not System.Windows.Form; and throws an error. Any help would be greatly appreciated


    using System.Windows.Form;

    public class MyIndicator : Indicator
    {

    private Form fHelp;

    private void tsHelpBtn_Click(object sender, EventArgs e)
    {
    fHelp = new Form();
    fHelp.StartPosition = FormStartPosition.CenterParent;
    fHelp.Owner = (Form)ChartControl.Parent; // even tried that to no avail

    fHelp.Show();
    }

    }

    Comment


      #3
      Hello funk101,

      Thank you for your post.

      What is the error reported when when you do fHelp.Show(this);?

      I look forward to assisting you further.
      Patrick H.NinjaTrader Customer Service

      Comment


        #4
        Originally posted by NinjaTrader_PatrickH View Post
        Hello funk101,

        Thank you for your post.

        What is the error reported when when you do fHelp.Show(this);?

        I look forward to assisting you further.
        See attached image
        Attached Files

        Comment


          #5
          Originally posted by funk101 View Post
          I'm simply trying to open a Form within the chart clientarea. Somehow, this eludes me. I've tried all the examples I've found and none of them work. I'm missing something. I guess the child does not really know who the parent is. When I do fHelp.Show(this); It's receiving NinjaScript.Indicator and not System.Windows.Form; and throws an error. Any help would be greatly appreciated


          using System.Windows.Form;

          public class MyIndicator : Indicator
          {

          private Form fHelp;

          private void tsHelpBtn_Click(object sender, EventArgs e)
          {
          fHelp = new Form();
          fHelp.StartPosition = FormStartPosition.CenterParent;
          fHelp.Owner = (Form)ChartControl.Parent; // even tried that to no avail

          fHelp.Show();
          }

          }
          Try using this post as a starting point?

          ref: http://www.ninjatrader.com/support/f...79&postcount=4

          Comment


            #6
            Hello funk101,

            Thank you for your response.

            And thanks to Koganam for his post on this matter. I am not sure of the resolution to your error here, as you mention this is an unsupported area. Please let me know if the suggestion by Koganam resolves the matter.
            Patrick H.NinjaTrader Customer Service

            Comment


              #7
              Originally posted by koganam View Post
              Try using this post as a starting point?

              ref: http://www.ninjatrader.com/support/f...79&postcount=4
              Yes my friend, that was totally it. Creating the class HelpForm(){} .

              public class HelpForm : Form
              {
              public Label lblTitle;

              public HelpForm()
              {
              ClientSize = new Size(400, 100);
              StartPosition = FormStartPosition.CenterScreen;
              lblTitle = new Label();
              lblTitle.Size = new Size(400, 50);
              lblTitle.Location = new Point(10, 10);
              lblTitle.Text = "Hello World";
              Controls.Add(lblTitle);
              }

              }

              then instantiate on button_Click() put's the form right in the center of chart. Thanks again

              Comment


                #8
                Originally posted by NinjaTrader_PatrickH View Post
                Hello funk101,

                Thank you for your response.

                And thanks to Koganam for his post on this matter. I am not sure of the resolution to your error here, as you mention this is an unsupported area. Please let me know if the suggestion by Koganam resolves the matter.
                Yes that helped. See my post.
                Thanks

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by dtl-saw, Today, 03:36 PM
                1 response
                7 views
                0 likes
                Last Post NinjaTrader_ChrisL  
                Started by williamzz, Today, 02:04 PM
                1 response
                10 views
                0 likes
                Last Post NinjaTrader_ChrisL  
                Started by jtrading82, Today, 01:55 PM
                3 responses
                26 views
                0 likes
                Last Post NinjaTrader_Tyler  
                Started by StevenNelson, Today, 01:00 PM
                4 responses
                19 views
                0 likes
                Last Post StevenNelson  
                Started by allinthechart, Today, 12:21 PM
                0 responses
                9 views
                0 likes
                Last Post allinthechart  
                Working...
                X