• 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

How to open a dialog from a script

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

    How to open a dialog from a script

    What is the way to open a WPF (modal) dialog from a script (Indicator, or BarsType)?

    I tried creating a WPF Window xaml, with its default partial handler class in Visual Studio, but I couldn't figure it out how can I run the InitializeComponent in the class: it says it cannot be found thus the xaml couldn't be applied.

    How can I make a simple popup dialog then?

    #2
    Hello Zapzap,

    Thanks for your inquiry.

    My colleague Chelsea has shared a sample Indicator and AddOn bundle where the Indicator can create an interactive AddOn window upon a button press and the AddOn window can then modify that indicator so it can display certain values. It may be a good example to help accomplish what you are trying to do.

    Our AddOn Framework example from the help guide can be used for further reference in creating NTWindows, but the sample should be enough to demonstrate creating an interactive window from an indicator that uses XAML for the window.

    Chelsea's example - https://ninjatrader.com/support/foru...86&postcount=8

    The AddOn Framework example is publicly available on this page of the help guide: https://ninjatrader.com/support/help...t_overview.htm

    Please let us know if we can be of further help.
    JimNinjaTrader Customer Service

    Comment


      #3
      PHP Code:
      FileStream fs = new FileStream(System.IO.Path.Combine(NinjaTrader.Core.Globals.UserDataDir, @"bin\Custom\AddOns\SetIndicatorValueFromAddonWindowExampleToolsContent.xaml"), FileMode.Open); 
      Do we really need filestream for this? What's up with exporting stuff to DLLs?

      Comment


        #4
        Hello Zapzap,

        You don't have to use a FileStream per se, but you will have to access the file and load it into memory so it can be used by the AddOn. The AddOn Framework example uses System.IO.Stream.

        I'm not sure what you are referring to with DLL's though. We have some information on exporting DLL's openly available in our help guide that details how to export NinjaScripts as DLL's. I'll provide a link below. If it doesn't answer your question, could you go into further detail?

        Exporting DLL's - https://ninjatrader.com/support/help...riptAsAssembly
        JimNinjaTrader Customer Service

        Comment


          #5
          Originally posted by NinjaTrader_Jim View Post
          Hello Zapzap,
          I'm not sure what you are referring to with DLL's though.
          That you are showing people to reference a xaml file which won't exist if you compile your whole thing into a DLL.

          BTW the NTWindow height is not changeable.

          Comment


            #6
            Hello Zapzap,

            You can either include the XAML by compiling the DLL in Visual Studio or by adding the XAML file to the zip package after exporting from NinjaTrader.

            This is outlined under the Considerations for Compiled Assemblies doc. Please see the "Adding XAML and Other Files Into a DLL" section therein.

            Considerations for Compiled Assemblies - https://ninjatrader.com/support/help...assemblies.htm

            NTWindow width and height will use the hard coded values initially and then save them to Documents/NinjaTrader 8/UI.xml. Once saved to Documents/NinjaTrader 8/UI.xml, NinjaTrader will use the stored values from the xml.
            JimNinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by Abilene, Today, 01:27 AM
            0 responses
            4 views
            0 likes
            Last Post Abilene
            by Abilene
             
            Started by simjs, Yesterday, 08:11 PM
            0 responses
            3 views
            0 likes
            Last Post simjs
            by simjs
             
            Started by mrlucky1x, Yesterday, 06:01 PM
            0 responses
            3 views
            0 likes
            Last Post mrlucky1x  
            Started by dedouglas, Yesterday, 03:17 PM
            1 response
            9 views
            0 likes
            Last Post NinjaTrader_Jesse  
            Started by Jugado, Yesterday, 02:22 PM
            2 responses
            30 views
            0 likes
            Last Post Jugado
            by Jugado
             
            Working...
            X