Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

SendKeys Use with NT8

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

  • 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(NinjaTrader.Core.Globals.InstallDir+@"\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:



    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:


  • jhowinvest
    replied
    Here is an example code that places bar numbers below bars and has a toolbar button to toggle the numbers on or off. Credit for the bar numbers themselves goes elsewhere (not sure who but thank you to whoever made it for NT7). I am just working on quickly turning them from visible to invisible using a transparent brush. A few issues/questions:

    1) The showbutton bool is not set as checked by default so you have to turn it on while adding indicator. Can someone let me know how to make it checked by default?

    2) If the bar numbers color is changed to anything but dimgray then the button does not turn it off and on like I want. I know the code is set up to only work with dimgray and transparent so if anyone can help identify a better way that would allow it to be switched back and forth between transparent and any color then please let me know.

    3) I have my code working well to add images to buttons and change the text font of buttons in NT7 but the windows.controls.button format NT8 is using has me confused on how to do this. Here are two small snippets of what I was doing with NT7 for issue 3.

    //Set text of button
    button = new ToolStripButton("#s");
    button = new ToolStripButton("#s");
    button.Font = new Font("Arial", 8,FontStyle.Bold);

    //Set image for button
    btnDeletebutton = new System.Windows.Forms.ToolStripButton("btnDelete");
    btnDeletebutton.DisplayStyle = ToolStripItemDisplayStyle.Image;
    btnDeletebutton.Image = Image.FromFile(Cbi.Core.InstallDir + @"\ToolbarImages\deletebutton.jpg");
    btnDeletebutton.Alignment = ToolStripItemAlignment.Left;
    btnDeletebutton.ToolTipText = "Delete Single Drawing";



    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.
    Attached Files

    Leave a comment:

Latest Posts

Collapse

Topics Statistics Last Post
Started by futtrader, 04-21-2024, 01:50 AM
5 responses
56 views
0 likes
Last Post NinjaTrader_Eduardo  
Started by PeakTry, Today, 10:49 AM
0 responses
2 views
0 likes
Last Post PeakTry
by PeakTry
 
Started by llanqui, Today, 10:32 AM
0 responses
5 views
0 likes
Last Post llanqui
by llanqui
 
Started by StockTrader88, 03-06-2021, 08:58 AM
45 responses
3,992 views
3 likes
Last Post johntraderuser2  
Started by TAJTrades, Today, 09:46 AM
0 responses
8 views
0 likes
Last Post TAJTrades  
Working...
X