• 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

SendKeys Use with NT8

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

  • jhowinvest
    started a topic SendKeys Use with NT8

    SendKeys Use with NT8

    I have NT7 indicators where I used SendKeys.Send to use hot keys etc. When I try to use send keys in NT8 I need :using System.Windows.Forms;" but I am getting errors when I add that to the using declarations. Any workarounds for this?

  • koganam
    replied
    Originally posted by -=Edge=- View Post
    I could swear I was able to do this previously, but after just doing some tests, I am now experiencing the same thing you are..


    You have to bring up the "MiniInstrumentSelector" box first.

    The method is detailed in this thread:

    ref: http://ninjatrader.com/support/forum...d.php?p=411233

    Leave a comment:


  • -=Edge=-
    replied
    Originally posted by neoikon View Post
    I'm trying to change the interval by using SendKeys ("30m" to change to the 30 minute chart, for example)

    In NT8, I've managed to successfully call the following ("Ctrl+i", which opens the Indicator Properties dialog)

    However, when I try and send other keys, nothing seems to happen (such as "30m").

    I could swear I was able to do this previously, but after just doing some tests, I am now experiencing the same thing you are..


    Leave a comment:


  • neoikon
    replied
    It seems like the people in this thread may know the answer, so I'm posting here.

    I'm trying to change the interval by using SendKeys ("30m" to change to the 30 minute chart, for example)

    In NT8, I've managed to successfully call the following ("Ctrl+i", which opens the Indicator Properties dialog)

    PHP Code:
    System.Windows.Forms.SendKeys.SendWait("^i"); 
    However, when I try and send other keys, nothing seems to happen (such as "30m").

    Is there a keystroke to bring up the "change interval" box? Send the keys from a different context?

    If anyone can point me in the right direction, I'd really appreciate it!

    Leave a comment:


  • -=Edge=-
    replied
    Originally posted by jhowinvest View Post
    I tried the converting bitmap code several ways with trial and error and could not get it to work.
    If you click on the link I provided in my previous post "BitmapImage Class", at the very bottom of that page it gives an exact C# example of how to create a BitmapImage, using that as the source to an Image, and than you just use that image as the btn.content..


    Leave a comment:


  • jhowinvest
    replied
    I tried the converting bitmap code several ways with trial and error and could not get it to work.
    I found this link: https://social.msdn.microsoft.com/Fo...ding?forum=wpf

    I used that method and I can get the image for the button. This may not be an efficient way but it is working. Here is the code that is working in case it will help anyone else.


    if (!isToolBarButtonAdded && showLine)

    {
    btnLine = new System.Windows.Controls.Button();
    ImageBrush brush = new ImageBrush(new BitmapImage(new Uri([email protected]"\Toolbar Images\line1.jpg")));
    brush.Stretch = Stretch.Uniform;//uniform seems to work best
    btnLine.Background = brush;
    btnLine.Content = " ";//3spaces

    btnLine.Click += btnLine_Click;
    chartWindow.MainMenu.Add(btnLine);
    }

    Leave a comment:


  • -=Edge=-
    replied
    Originally posted by jhowinvest View Post
    Here is what I have tried and the image is not showing up. It may be a simple syntax error but it continues to compile and has no errors but the image is not showing up.
    Simple Search of "WPF BitmapImage" .. Again first result..

    BitmapImage Class


    Leave a comment:


  • jhowinvest
    replied
    Here is what I have tried and the image is not showing up. It may be a simple syntax error but it continues to compile and has no errors but the image is not showing up. I have commented out several lines that I have tried. None have worked so far to get the image.

    //btnLine = new System.Windows.Controls.Button { Content = "o-o" };
    btnLine = new System.Windows.Controls.Button();

    //BitmapImage btm = new BitmapImage(new Uri("c://ToolbarImages/Line1.jpg", UriKind.Relative));
    //BitmapImage btm = new BitmapImage(new Uri("c://ToolbarImages\Line1.jpg", UriKind.Relative));
    //BitmapImage btm = new BitmapImage(new Uri(startupPath+ @"\ToolbarImages\Line1.jpg", UriKind.Relative));
    BitmapImage btm = new BitmapImage(new Uri("c://ToolbarImages/Line1.jpg", UriKind.Relative));

    Image img = new Image();

    img.Source = btm;

    img.Stretch = Stretch.Fill;
    btnLine.Content = img;
    btnLine.Click += btnLine_Click;
    chartWindow.MainMenu.Add(btnLine);

    Leave a comment:


  • -=Edge=-
    replied
    Originally posted by jhowinvest View Post
    Awesome. Thank you for your post Edge. I will check out those links. Your screenshots look great. Looks like you have made some great progress with the tool bars. Thanks again.
    Thanks.. It's been a lot of long hard hours, with most of it probably being reading and research vs the coding itself.. Well maybe not most, but there is defiantly a learning curve involved here.. Still have a ton to do, but things are defiantly starting to look up, yes. Good luck to you as well..


    Leave a comment:


  • jhowinvest
    replied
    Awesome. Thank you for your post Edge. I will check out those links. Your screenshots look great. Looks like you have made some great progress with the tool bars. Thanks again.

    Leave a comment:


  • -=Edge=-
    replied
    Originally posted by jhowinvest View Post
    I updated the code which resolved issue 1 from my earlier post #5. I also added buttons for line, ray, delete, copy, paste, increase/decrease bar spacing, increase decrease bar thickness and load chart template. The load chart template isn't working completely (Only the right click menu is accessed) NT7 allowed you to hit "t" for template then "l" for load on the keyboard to complete the load template. All of this is done with send keys. The buttons are ugly because I can only use text for them. Still hoping someone can help us shed light on how to improve the look of the buttons. Also, if anyone has any improvements or wants to build from this then please do and share. The goal of this is to give us one click access to frequently used items. Code is set up to allow any buttons to be left off by un-checking in the parameters.

    FYI...for some reason the default hotkeys for increase/decrease bar spacing would not take so I changed them to alt-0 and ctrl-0 so anyone who tries to use the buttons will have to do the same.
    Looks like you've got a good start.. That's the problem with using sendkey to activate hot keys as your button click event, your limiting anyone from personally customizing their hotkeys.. You might want to combine all those Dispatcher calls in the terminate to just one call (like you've done in the config), and there is no need for all the !isToolBarButtonAdded checks in all those if's in the config.. (you've already checked that prior to running the dispatcher in the first place)..

    Button images, get a bit tricky.. one way, since it looks like your using a physical image located on your computer, would be creating a BitmapImage using a Uri as souce, then using that as the source to an Image, then using that Image as the btn.content.. heh.. Search "WPF Dynamic Button Image" from yahoo and the very first result should get you started.. "Dynamic" being the key word to get around all the xaml examples..

    But I definitely use buttons for everything! Wouldn't have an indicator without one! There are no splitbuttons in wpf... That's all done with context menu's now.. and although I do find this wpf way more cumbersome to code, it's all doable!



    For things like my drawbar and color palette, rather than cluttering up the indicator properties window and the cumbersome way of changing all those settings, I'm going to use context menus along with my own property window that can all be accessed with a simple click of the indicators button icon..



    Almost ready to release a few products, just need to finalize my personal server authentication check, finish up a few more code tweaks, and should be ready to go..


    Attached Files

    Leave a comment:


  • jhowinvest
    replied
    To follow up. All code snippets I am finding for WPF and incorporating images for buttons are for xaml and not c#. Below is an example:

    <Button>
    <StackPanel>
    <Image Source="Pictures/apple.jpg" />
    <TextBlock>Disconnect from Server</TextBlock>
    </StackPanel>
    </Button>

    Leave a comment:


  • jhowinvest
    replied
    I updated the code which resolved issue 1 from my earlier post #5. I also added buttons for line, ray, delete, copy, paste, increase/decrease bar spacing, increase decrease bar thickness and load chart template. The load chart template isn't working completely (Only the right click menu is accessed) NT7 allowed you to hit "t" for template then "l" for load on the keyboard to complete the load template. All of this is done with send keys. The buttons are ugly because I can only use text for them. Still hoping someone can help us shed light on how to improve the look of the buttons. Also, if anyone has any improvements or wants to build from this then please do and share. The goal of this is to give us one click access to frequently used items. Code is set up to allow any buttons to be left off by un-checking in the parameters.

    FYI...for some reason the default hotkeys for increase/decrease bar spacing would not take so I changed them to alt-0 and ctrl-0 so anyone who tries to use the buttons will have to do the same.
    Attached Files
    Last edited by jhowinvest; 09-26-2015, 06:26 AM.

    Leave a comment:


  • jhowinvest
    replied
    Thanks Edge. I used your thread to help me get to this point with NT8 but I am not finding resources that show how to use System.Windows.Controls in any more detail.

    For example this link has all of the snippets missing. It show buttons but doesn't show any c# code for them:

    https://msdn.microsoft.com/en-us/lib...v=vs.110).aspx

    Still need help on issues 1-3 from my earlier posts. I think the code I attached can help get the ball rolling for adding buttons that help make doing basic chart related things more efficient but the buttons will be much better if we have the functionality of System.Windows.Forms

    I attached pictures of one of my NT7 charts with my main toolbar indicator and my mini dockable toolbar that both include copy and paste, delete, open new chart, load chart templates etc. I think this is useful and others might find it useful as well but NT8 doesn't seem to be as easy to work with for this. I just want to be able to quickly and efficiently do the things I need to do often during the trading day without right clicking, selecting, and/or making 2-4 clicks or hitting multiple hotkeys on the keyboard when the NT7 toolbars I made allow me to do it all with one click.
    Attached Files
    Last edited by jhowinvest; 09-25-2015, 09:56 PM.

    Leave a comment:


  • -=Edge=-
    replied
    Originally posted by jhowinvest View Post
    Here are two small snippets of what I was doing with NT7 for issue 3.I hope this helps with those that are trying to use toolbar buttons. I want as many shortcuts as possible to reduce clicks and keystrokes and this is a start.
    All of the sample code you posted is for System.Windows.Forms.. With NT8 you will need to use System.Windows.Controls instead.. Take a look at this thread

    Buttons-StackPanels-DockPanels

    as there are examples there of both placing a button in NT8 toolbar and placing panels with buttons on the chart itself..


    Leave a comment:

Latest Posts

Collapse

Topics Statistics Last Post
Started by CriticalMind, 11-29-2015, 12:39 PM
3 responses
1,321 views
0 likes
Last Post NinjaTrader_ChelseaB  
Started by novel168, 06-14-2019, 09:20 PM
1 response
7 views
0 likes
Last Post NinjaTrader_ChelseaB  
Started by johnnybegoode, Today, 08:00 PM
3 responses
7 views
0 likes
Last Post NinjaTrader_ChelseaB  
Started by digibob, Today, 03:00 PM
1 response
6 views
0 likes
Last Post NinjaTrader_ChelseaB  
Started by yeshujbp, Today, 02:50 PM
1 response
10 views
0 likes
Last Post NinjaTrader_ChelseaB  
Working...
X