Announcement

Collapse
No announcement yet.

Text.BUTTON Mouse Click

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

  • Text.BUTTON Mouse Click

    Greetings,

    My application puts up text buttons that the user can click on. In the handler for the text button, I would like to distinguish between whether the button was clicked with the left mouse button or the right mouse button. I have tried the button handlers (onRButtonDown(), etc.) but they execute separately (and who knows the order!) from the programmer defined text button handler.

    Any ideas as to how I can distinguish between whether the text button handler was invoked with a left or right mouse click?

    Tx,

    Scott
    Scott Masters
    www.tic2tic.com
    [email protected]

  • #2
    I don't believe this is possible..

    As I understand the TEXT clicks - they act as LINKS on a web page (<A HREF="">). They do not determine the type of click - just a click.

    B
    Brad Matheny
    eSignal Solution Provider since 2000

    Comment


    • #3
      Scott,

      Take a look at a trend line alert efs I posted last year and you will see how I handled the differentiation. For myself, I have found the left and right clicks work the best when taking actions related to button selection and the left doubleclick works best when seleting points on the chart. Here is how I presently differentiate between left and right clicks on a button, slightly simplified from the referenced efs.
      PHP Code:
      function Fourth_button_Actions(nButtonPressed){//called when button is selected
       
       
      if (nButtonPressed == ){//Left click toggles button displays
        //take actions here
        
      getButtons(); //redraw buttons based on actions
       

       if (
      nButtonPressed== ){//Right click toggles button displays
        //take actions here
        
      getButtons(); //redraw buttons based on actions
       
      }

      As to figuring out the order of the button handlers, If you would like, I can dig out and post an efs later today that demonstrates the sequence of actions relative to how the button clicks are sensed. This simplifies things greatly in my opinion and the order of selection will become very clear.

      Comment


      • #4
        Thanks Steve. I appreciate the help. And yes, I would further clarify things if you could post the efs you were referring to that would further illuminate the sequence of how mouse clicks are handled.

        Scott
        Scott Masters
        www.tic2tic.com
        [email protected]

        Comment


        • #5
          Scott,

          Here it is, ensure you have your formula output window open and try holding down the left button...then release. Then clear the formula output window and do a left double click. The sequencing will become very clear.

          The right click in the chart pulls up the chart menu which diminishes it's usefulness. It works fine if selecting a button (that concept as discussed in other post is not demonstrated in this efs).

          PHP Code:
          //Test of different button actions by S. Hare 5/2/2005
          //Modified Chris Kryza's help file

          function preMain() { 

           
          setPriceStudy(true); 
           
          setStudyTitle("Mouse Button Clicks"); 
           
          setShowCursorLabel(false); 



          function 
          main() { 


          function 
          onLButtonDownbarIndexyValue) { 

            
          debugPrintln("17: LeftDown: " barIndex ", " yValue.toFixed(2)+" time = "+new Date().getTime()); 
            
          updateClickInfo(barIndexyValue); 



          function 
          onLButtonUpbarIndexyValue) { 

            
          debugPrintln("24: LeftUp: " barIndex ", " yValue.toFixed(2)+" time = "+new Date().getTime()); 
            
          updateClickInfo(barIndexyValue); 



          function 
          onLButtonDblClkbarIndexyValue) { 

            
          debugPrintln("31: LeftDblClk: " barIndex ", " yValue.toFixed(2)+" time = "+new Date().getTime()); 
            
          updateDblClickInfo(barIndexyValue); 



          function 
          onRButtonDownbarIndexyValue) { 

           
          debugPrintln("38: RightDown: " barIndex ", " yValue.toFixed(2)+" time = "+new Date().getTime()); 
           
          updateClickInfo(barIndexyValue); 



          function 
          onRButtonUpbarIndexyValue) { 

           
          debugPrintln("45: RightUp: " barIndex ", " yValue.toFixed(2)+" time = "+new Date().getTime()); 
           
          updateClickInfo(barIndexyValue); 
           


          function 
          onRButtonDblClkbarIndexyValue) { 

           
          debugPrintln("52: RightDblClk: " barIndex ", " yValue.toFixed(2)+" time = "+new Date().getTime()); 
           
          updateDblClickInfo(barIndexyValue); 



          function 
          updateClickInfo(barIndexyValue) { 

           
          drawTextAbsolute(515"Clicked bar " barIndex " at " yValue.toFixed(2), 
           
          Color.whiteColor.navyText.RELATIVETOLEFT|Text.RELATIVETOBOTTOM|Text.BOLDnull14"ClickInfo"); 
              


          function 
          updateDblClickInfo(barIndexyValue) { 

           
          drawTextAbsolute(535"Double Clicked bar " barIndex " at " yValue.toFixed(2),  
           
          Color.whiteColor.navyText.RELATIVETOLEFT|Text.RELATIVETOBOTTOM|Text.BOLDnull14"DblClickInfo");

          Attached Files

          Comment


          • #6
            Gentlemen,

            what would be the best (easiest) coordinates to use to place buttons in the lower right corner of the Price Pane?

            Thanks,

            ziggy

            Comment


            • #7
              Ziggy,

              Look at the bottom of the efs I posted. You will see the coordinates in the last two functions. I would suggest running the efs then try changing the coordinates. This will give you a pretty good feel for your preferred location.

              The flags determine where the relative location of the buttons will appear, e.g. Text.RELATIVETOLEFT|Text.RELATIVETOBOTTOM.

              Comment


              • #8
                Thanks Steve.

                What actually happens when a custom button is pressed? does the EFS preserve the point of login in main and resume at that point after button function is executed? what if the button function changes certain state variables in main ....how does the continued execution of main reflect these change?

                ziggy

                Comment


                • #9
                  Thanks Steve.

                  What actually happens when a custom button is pressed? does the EFS preserve the point of logic in main and resume at that point after button function is executed? what if the button function changes certain state variables in main ....how does the continued execution of main reflect these change?

                  ziggy

                  Comment


                  • #10
                    Hello z11,

                    It's highly unlikely that you would click a button during the execution of main generated by a price update. I don't think you need to worry about that happening. If the event were to occur, I'm pretty sure main() would finish its processing before the button function would be processed. In other words, main() wouldn't stop midway through, run your button function, and then finish main().
                    Jason K.
                    Project Manager
                    eSignal - an Interactive Data company

                    EFS KnowledgeBase
                    JavaScript for EFS Video Series
                    EFS Beginner Tutorial Series
                    EFS Glossary
                    Custom EFS Development Policy

                    New User Orientation

                    Comment

                    Working...
                    X