Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Windows.Forms - Buttons - Sample Script

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

    Windows.Forms - Buttons - Sample Script

    Hi, could anybody please be so kind and provide a sample script for a button in NT8. Somehow, I did not get it to work.

    Thanks for the help.

    In NT7 I used somethink like:
    VARIABLES:

    #region Button Definition
    private ToolStrip strip = null;
    private ToolStripSeparator vTSS00;
    private ToolStripButton vBtn00 = null; // Mo
    private bool swBtn00 = true; // Mo
    private bool swBtnP00 = true; // Mo
    private string vBtnText00 = "Cloud_I/O";
    #endregion Button Definition

    FUNCTION:
    #region MouseBtn00
    private void hsBtn00(object s, EventArgs e)
    {
    if ( swBtn00 == false )
    {
    swBtn00 = true;
    swBtnP00 = false;
    vBtn00.ForeColor = Color.DarkGray;
    vBtn00.BackColor = Color.Transparent;
    }
    else if (swBtn00 == true)
    {
    swBtn00 = false;
    swBtnP00 = true;
    vBtn00.ForeColor = Color.Blue;
    vBtn00.BackColor = Color.LightGreen;
    }

    ChartControl.ChartPanel.Refresh();
    }
    #endregion MouseBtn00

    OnStartUp():
    Control[] tscontrol = ChartControl.Controls.Find("tsrTool",false);
    if(tscontrol.Length > 0)
    {
    vBtn00 = new ToolStripButton(vBtnText00);
    vBtn00.Click += hsBtn00;
    vTSS00 = new ToolStripSeparator ();
    strip = (ToolStrip) tscontrol[0];
    strip.Items.Add(vTSS00);
    strip.Items.Add(vBtn00);
    vBtn00.ForeColor = Color.Blue;
    vBtn00.BackColor = Color.LightGreen;
    }
    base.OnStartUp();

    #2
    You won't be able to use Windows.Forms anymore as current WPF is completely different technology.

    Saying this - could you NT guys provide us with at least chart Toolbar automationID so we could experiment (adding buttons to toolbar is possibly the most used customization of the chart in NT7 and I suppose it will be the same with NT8)

    Comment


      #3
      Originally posted by gregid View Post
      You won't be able to use Windows.Forms anymore as current WPF is completely different technology.
      Yes and No.. I'm very much hoping we'll be able to utilize the System.Windows.Forms.Integration to bring in a ToolStrip, and/or at least a splitbutton.. As WPF doesn't have one by default, and it's a major pain to create one.. It would be so so much easier to utilize much of what I already have coded..

      Originally posted by gregid View Post
      Saying this - could you NT guys provide us with at least chart Toolbar automationID so we could experiment (adding buttons to toolbar is possibly the most used customization of the chart in NT7 and I suppose it will be the same with NT8)
      Yes, Please, or at least a hint or two.. I'm close, but yet so far.. And spending much too much time thinking about this, that could be spent on something much more productive.. Just adding a child doesn't seem to work, messes up the margins on both sides of the chart.. is it a child of a child maybe? heh..


      Attached Files
      -=Edge=-
      NinjaTrader Ecosystem Vendor - High Tech Trading Analysis

      Comment


        #4
        Originally posted by gregid View Post
        You won't be able to use Windows.Forms anymore as current WPF is completely different technology.

        Saying this - could you NT guys provide us with at least chart Toolbar automationID so we could experiment (adding buttons to toolbar is possibly the most used customization of the chart in NT7 and I suppose it will be the same with NT8)
        We will be adding a toolbar automation ID in beta release 2 - NTEIGHT-8218
        Last edited by NinjaTrader_Matthew; 05-12-2015, 03:20 PM.
        MatthewNinjaTrader Product Management

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by zstheorist, Today, 07:52 PM
        0 responses
        7 views
        0 likes
        Last Post zstheorist  
        Started by pmachiraju, 11-01-2023, 04:46 AM
        8 responses
        150 views
        0 likes
        Last Post rehmans
        by rehmans
         
        Started by mattbsea, Today, 05:44 PM
        0 responses
        6 views
        0 likes
        Last Post mattbsea  
        Started by RideMe, 04-07-2024, 04:54 PM
        6 responses
        33 views
        0 likes
        Last Post RideMe
        by RideMe
         
        Started by tkaboris, Today, 05:13 PM
        0 responses
        6 views
        0 likes
        Last Post tkaboris  
        Working...
        X