Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

NinjaTrader 7 simple form

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

    NinjaTrader 7 simple form

    In NinjaTrader 7 I has a simple form like this :

    public class NewsForm : Form
    {
    public TextBox txtBoxResult;

    public NewsForm()
    {
    ClientSize = new Size(600,320);
    StartPosition = FormStartPosition.WindowsDefaultLocation;
    this.TopMost = true;
    txtBoxResult = new TextBox();
    txtBoxResult.ScrollBars = ScrollBars.Both;
    txtBoxResult.Size = new Size(580,300);
    txtBoxResult.Location = new Point(10,10);
    txtBoxResult.ReadOnly = true;
    txtBoxResult.Multiline = true;
    txtBoxResult.WordWrap =false;
    Controls.Add(txtBoxResult);

    this.Shown += new System.EventHandler(this.NewsForm_Shown);
    this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this. NewsForm_FormClosing);
    }

    Now I am confused about how to convert that to WPF NinjaTrader 8 ?

    Need help please
    Thank you !

    #2
    Originally posted by blar58 View Post
    In NinjaTrader 7 I has a simple form: Now I am confused about how to convert that to WPF NinjaTrader 8?
    Although I did have some small success using old WinForms from NT7 in NT8.. Because of various issues that kept cropping up here and there (transparency, events, blabla), I've since converted all of those Forms to Windows, adding my controls and events to them instead..

    Although it was a major pain to convert and re-code all the previous existing code, I must say it does work much better..




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

    Comment


      #3
      OK. Thank you Edge.

      Now when you say converted to Windows are you talking about AddOn. Could you just give me a small code snippet to guide me on the right path.

      Thanks again for your help

      Comment


        #4
        Originally posted by blar58 View Post
        OK. Thank you Edge. Now when you say converted to Windows are you talking about AddOn. Could you just give me a small code snippet to guide me on the right path. Thanks again for your help
        No.. Just create a new window right in the indicator code itself.. I'm actually using an NTWindow but either/or will work..

        //Variable
        private NTWindow myWindow;
        //somewhere in code - Suggest using Dispatcher and UI thread
        //create window
        myWindow = new NTWindow();
        //set properties
        myWindow.(Various Properties) = (whatever);
        //show window
        myWindow.Show();
        //hide window
        myWindow.Hide();


        You'll probably want to create a grid with multiple columns and rows, then add your controls to that, and than that grid as the myWindow.Content.. Don't forget to dispose of anything needed disposing on termination..

        You'll probably need to do some reading and research on much of this.. Simple search of "WPF Dynamic Window" should help get you started.. Key word there dynamic, as you'll probably want to do all this directly in code vs having to create and use xaml..

        Hope that helps get you started.. Good Luck!




        Edit: You'll also need to add using NinjaTrader.Gui.Tools for the NTWindow..
        -=Edge=-
        NinjaTrader Ecosystem Vendor - High Tech Trading Analysis

        Comment


          #5
          Very helpful Edge.
          Greatly appreciated

          Thank you very much for your time !

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by andrewtrades, Today, 04:57 PM
          1 response
          8 views
          0 likes
          Last Post NinjaTrader_Manfred  
          Started by chbruno, Today, 04:10 PM
          0 responses
          6 views
          0 likes
          Last Post chbruno
          by chbruno
           
          Started by josh18955, 03-25-2023, 11:16 AM
          6 responses
          436 views
          0 likes
          Last Post Delerium  
          Started by FAQtrader, Today, 03:35 PM
          0 responses
          7 views
          0 likes
          Last Post FAQtrader  
          Started by rocketman7, Today, 09:41 AM
          5 responses
          19 views
          0 likes
          Last Post NinjaTrader_Jesse  
          Working...
          X