Show coordinates of mouse on page ?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts
  • bobbie
    Forum Member
    • Feb 2005
    • 770

    Show coordinates of mouse on page ?

    Can you show the coordinates of the mouse on a page ?
    See screenshot.
    Attached Files
  • yosik
    Indigo Rose Customer
    • Jun 2002
    • 1858

    #2
    Please read the help file:
    System.GetMousePosition

    Yossi

    Comment

    • bobbie
      Forum Member
      • Feb 2005
      • 770

      #3
      Ok I seem to have something wrong as it is not displaying the mouse coordinates
      just the tMousePos ?
      Code:
      tMousePos = System.GetMousePosition(true);
      Label.SetText("Label2", "tMousePos");
      Thanks for helping me with this.

      Comment

      • RizlaUK
        Indigo Rose Customer
        • May 2006
        • 5552

        #4
        here m8, try this

        tMousePos = System.GetMousePosition(true);
        Label.SetText("Label1", tMousePos.X.." x "..tMousePos.Y);
        Embrace change in your life, you never know, it could all work out for the best

        Comment

        • bobbie
          Forum Member
          • Feb 2005
          • 770

          #5
          Well it changed the label but it gave the page size. lol
          So how do I get to show the postion of the mouse in the window.
          Ok it does get the postion but only one time when it starts up. how can I have it keep giving the postion as the mouse moves over the page ? or can I?
          Last edited by bobbie; 01-18-2007, 03:08 PM.

          Comment

          • RizlaUK
            Indigo Rose Customer
            • May 2006
            • 5552

            #6
            try this

            tMousePos = System.GetMousePosition(true);
            Window.SetText(Application.GetWndHandle(), tMousePos.X.." x "..tMousePos.Y);

            EDIT:

            sorry bobbie, i misread your post, put the code in mouse move event
            Embrace change in your life, you never know, it could all work out for the best

            Comment

            • Roboblue
              Forum Member
              • Dec 2003
              • 892

              #7
              You need a Timer function to do this

              Try Page-On Mouse
              Code:
              if(e_Type == RIGHT_BUTTON_DOWN)then
              Page.StartTimer(70)
              end
              if(e_Type == LEFT_BUTTON_DOWN)then
              Page.StopTimer();
              end
              Page-On Timer
              Code:
              SMouse = System.GetMousePosition(true);
              Input.SetText("Input1", ""..SMouse.X.." , "..SMouse.Y.."");
              This will start the tracking on the mouse-right click, and end it on the mouse-left click. Handy for a quick little ruller ap. Just add an on top button, input box, and go.
              You can also use keystrokes (virtual keys)
              On Page-On Key add
              Code:
              if System.IsKeyDown(32) then
              Page.StartTimer(70);
              end
              if System.IsKeyDown(66) then
              Page.StopTimer();
              end
              key 32 is the spacebar, key 66 is the letter "b"
              you can find the virtual keycodes in the Help. Search for virtual key codes.
              I have them printed out.
              Last edited by Roboblue; 01-18-2007, 03:14 PM.

              Comment

              • RizlaUK
                Indigo Rose Customer
                • May 2006
                • 5552

                #8
                no timer needed robo, mouse move will do the trick m8
                Embrace change in your life, you never know, it could all work out for the best

                Comment

                • bobbie
                  Forum Member
                  • Feb 2005
                  • 770

                  #9
                  Thanks guys for all the help. moving it to the mouse move works fine now.

                  Comment

                  • Roboblue
                    Forum Member
                    • Dec 2003
                    • 892

                    #10
                    Originally posted by RizlaUK View Post
                    no timer needed robo, mouse move will do the trick m8
                    Yeah, but I was thinking if you don't want it happening all the time, this is how you can fire it, then stop it so the last coordinate is frozen to be used to set an object.
                    Makes it easier to record the info.
                    In my ruler app, I also have a distance between two set points output and a space between objects calculator. Pretty handy to get things alined.
                    I use more than AMS to develop with.
                    Anyway, putting it on the mouse move is ok if you want to always have it displayed.

                    Comment

                    • bobbie
                      Forum Member
                      • Feb 2005
                      • 770

                      #11
                      Thanks for the tip Roboblue, I don't care if it shows all the time. but good to know the other way too.

                      Comment

                      • RizlaUK
                        Indigo Rose Customer
                        • May 2006
                        • 5552

                        #12
                        Thanks for the tip Roboblue, I don't care if it shows all the time. but good to know the other way too.

                        yeah, i dident think of that, in fact thats given me an idea, what with just reading about creating objects on the fly and setting custom masks.....watch this space....lol
                        Embrace change in your life, you never know, it could all work out for the best

                        Comment

                        • Josué Alba
                          Forum Member
                          • Mar 2005
                          • 225

                          #13
                          Just an example using onMouse Move instead of Timers.
                          Attached Files
                          Last edited by Josué Alba; 01-18-2007, 04:30 PM. Reason: I forgot the attachment

                          Comment

                          • Roboblue
                            Forum Member
                            • Dec 2003
                            • 892

                            #14
                            WOW, Your idea gives me an idea!
                            I have too many on the fire, now. My head is 'splodin'
                            I am going to try using a mask to simulate Window Blinds.
                            Has anyone tried this?
                            It won't be hard, but I'm afraid that on a slower machine, it'll look crappy.
                            I guess I'll know in a few days.

                            Comment

                            • bobbie
                              Forum Member
                              • Feb 2005
                              • 770

                              #15
                              Thats what I have now Josué Alba?

                              Comment

                              Working...
                              X