Announcement

Collapse
No announcement yet.

Mouse functions - Not working

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

  • Mouse functions - Not working

    Hi,
    I am trying to use mouse functions. But mouse events like Left Button click etc are not getting captured. Any suggestion ?
    Thanks in Advance
    Ramesh

    I have used following code...

    function preMain()
    {
    setPriceStudy(true);
    setStudyTitle("Left Mouse Button Clicks");
    setShowCursorLabel(true);
    }

    function main()
    {

    }

    function onLButtonDown( barIndex, yValue)
    {
    debugPrintln("LeftDown: " + barIndex + ", " + yValue);
    updateClickInfo(barIndex, yValue);
    }

    function onLButtonDblClk( barIndex, yValue)
    {
    debugPrintln("LeftDblClk: " + barIndex + ", " + yValue);
    updateDblClickInfo(barIndex, yValue);
    }

    function updateClickInfo(barIndex, yValue)
    {
    drawTextAbsolute(5, 15, "Clicked bar " + barIndex + " at " + yValue.toFixed(2),
    Color.white, Color.navy, Text.RELATIVETOLEFT|Text.RELATIVETOBOTTOM|Text.BOL D,
    null, 14, "ClickInfo");
    }

    function updateDblClickInfo(barIndex, yValue)
    {
    drawTextAbsolute(5, 35,
    "Double Clicked bar " + barIndex + " at " + yValue.toFixed(2),
    Color.white, Color.navy,
    Text.RELATIVETOLEFT|Text.RELATIVETOBOTTOM|Text.BOL D,
    null, 14, "DblClickInfo");
    }

  • #2
    The mouse functions only work if you hold the "Shift" key down when you click your mouse. I copied your onLButtonDown and updateClickInfo functions and tested them and they worked for me when I held the "Shift" key down before clicking the mouse. I'm sure that "Text.BOL D" is actually "Text.BOLD" or it wouldn't compile.

    Comment

    Working...
    X