• 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 override PLOT to get mouse click?

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

    How to override PLOT to get mouse click?

    I want when user clicks mouse on chart:

    1) to alert "Mouse clicked" message
    2) to check, if specific KEYBOARD key is also pressed at the same time.

    is that possible with override PLOT() ?

    (btw, there are ways with custom c# even handler creations, but i wanted to know if there is a simple way with PLOT);
    Last edited by TazoTodua; 05-28-2018, 10:03 PM.

    #2
    Originally posted by TazoTodua View Post
    I want when user clicks mouse on char:
    Sorry, I am confused.
    You mean the chart or a character on the keyboard?

    Originally posted by TazoTodua View Post
    1) to alert "Mouse clicked" message
    This requires a mouse hook. I'll look around for an example.

    EDIT:
    Actually, it's called a "Mouse Event Handler".

    Originally posted by TazoTodua View Post
    2) to check, if specific KEYBOARD key is also pressed at the same time.
    Which key? It makes a difference, for ex, Shift/Ctrl/Alt keys (commonly used in conjunction with mouse clicks) would be different than a normal keyboard character.

    Originally posted by TazoTodua View Post
    is that possible with override PLOT() ?

    (btw, there are ways with custom c# even handler creations, but i wanted to know if there is a simple way with PLOT);
    I doubt it.
    Plot() doesn't have anything to do with the mouse.
    Plot() is ultimately an "output" function, not an "input" function.
    Last edited by bltdavid; 05-28-2018, 10:43 AM.

    Comment


      #3
      Hello TazoTodua,

      This would be outside of what is supported by NinjaTrader Support. However, this thread will remain open for any community members that would like to assist.

      With that said, I would recommend taking a look at the thread below about capturing the KeyDown event.
      https://ninjatrader.com/support/foru...ad.php?t=74020

      And the custom cross hair for capturing mouse events.
      https://ninjatrader.com/support/foru...php?linkid=626

      You can also contact a professional NinjaScript Consultant who would be eager to create or modify this script at your request or assist you with your script. The NinjaTrader Ecosystem has affiliate contacts who provide educational as well as consulting services. Please let me know if you would like our business development follow up with you with a list of affiliate consultants who would be happy to create this script or any others at your request.
      Chelsea B.NinjaTrader Customer Service

      Comment


        #4
        Originally posted by bltdavid View Post
        This requires a mouse hook. I'll look around for an example.

        EDIT:
        Actually, it's called a "Mouse Event Handler".
        I went to Version 7 Indicators in Download section, and used the 'Keyword Filter' dropdown to select "Mouse". The indicator "dDrawABC" came up.

        I just checked the code, if you understand C# programming this looks to be a great example of what you'll want to do.

        The idea is to add an event handler for "MouseDown" to the ChartPanel (basically a reference to your own function that gets called on mouse down events).

        Inside your mouse down handler, check for your specific keypress being in down state at same time -- for ex, look at line 369 in dDrawABC.cs for an example using the 'Alt' key.
        Last edited by bltdavid; 05-28-2018, 11:19 AM.

        Comment


          #5
          1) yes, chart (was a spell error)
          2) lets say, i want CTRL (or ****)

          Comment


            #6
            Originally posted by TazoTodua View Post
            1) yes, chart (was a spell error)
            2) lets say, i want CTRL (or ****)
            I think you mean SHIFT ... another typo?

            Google for "C# Modifier Keys".

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

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by i2w8am9ii2, Today, 06:57 AM
            1 response
            3 views
            0 likes
            Last Post NinjaTrader_PatrickG  
            Started by buzzripper, Today, 06:14 AM
            1 response
            2 views
            0 likes
            Last Post NinjaTrader_Ray  
            Started by sidviciousX, Today, 06:47 AM
            1 response
            3 views
            0 likes
            Last Post NinjaTrader_RyanS  
            Started by TazoTodua, Today, 07:17 AM
            0 responses
            2 views
            0 likes
            Last Post TazoTodua  
            Started by frankduc, Today, 07:02 AM
            0 responses
            1 view
            0 likes
            Last Post frankduc  
            Working...
            X