• Login
sketchucation logo sketchucation
  • Login
🔌 Quick Selection | Try Didier Bur's reworked classic extension that supercharges selections in SketchUp Download

Set cursor position?

Scheduled Pinned Locked Moved Developers' Forum
11 Posts 6 Posters 1.0k Views 6 Watching
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    Pixero
    last edited by 8 Aug 2010, 16:16

    Is it in any way possible to set the cursors position on the screen?

    1 Reply Last reply Reply Quote 0
    • T Offline
      thomthom
      last edited by 8 Aug 2010, 16:19

      You'd have to use system calls. No SU API methods for such thing.

      Thomas Thomassen — SketchUp Monkey & Coding addict
      List of my plugins and link to the CookieWare fund

      1 Reply Last reply Reply Quote 0
      • P Offline
        Pixero
        last edited by 9 Aug 2010, 09:19

        I was afraid of that. Does that mean there would have to be two separate solutions for Mac and PC?
        Is there any examples on how it's done?

        1 Reply Last reply Reply Quote 0
        • T Offline
          thomthom
          last edited by 9 Aug 2010, 09:23

          Yea - separate method for each platform.
          No idea how to do it on OSX.
          But on Windows you'd use the Win32API to make a call to SetCursorPos: http://msdn.microsoft.com/en-us/library/ms648394%28VS.85%29.aspx

          Thomas Thomassen — SketchUp Monkey & Coding addict
          List of my plugins and link to the CookieWare fund

          1 Reply Last reply Reply Quote 0
          • D Offline
            Dan Rathbun
            last edited by 9 Aug 2010, 10:34

            @thomthom said:

            No idea how to do it on OSX.



            http://devimages.apple.com/assets/elements/header/developer.png

            Mac OSX Reference Library

            I'm not here much anymore.

            1 Reply Last reply Reply Quote 0
            • A Offline
              AdamB
              last edited by 10 Aug 2010, 15:51

              Pixero, can you share what you're trying to do?

              Its generally viewed as bad practice for programs to move mouse cursors rather than allow the user control of interactions. Is there another way of expressing what you want?

              Adam

              Developer of LightUp Click for website

              1 Reply Last reply Reply Quote 0
              • P Offline
                Pixero
                last edited by 10 Aug 2010, 16:58

                @adamb said:

                Pixero, can you share what you're trying to do?

                Its generally viewed as bad practice for programs to move mouse cursors rather than allow the user control of interactions. Is there another way of expressing what you want?

                Adam

                I'm writing a Camera Tool that would benefit greatly from not stopping at the edge of the screen when panning.
                I'm currently investigating two separate solutions:
                A) Keeping the cursor (hidden) centered on screen and get the difference between the mouse position and the center of the screen each frame, then reset the mouse position to the center, like some game engines does. Most likely when onLButtonDown is true so it reappears when onLButtonUp. Giving the user the control of cursor interaction back.
                B) Wrapping the cursor when it's at the edge of the screen so it appears at the opposite edge.

                Both solutions need to be able to set the cursor position though.

                Any thoughts?

                1 Reply Last reply Reply Quote 0
                • A Offline
                  AdamB
                  last edited by 10 Aug 2010, 17:31

                  OK, in video games running under Windows, we always go for the former. ie Keep it hidden and centered and generate deltas. potentially getting the root window handle's mouse events also (ie the whole desktop).

                  However, in the context of a Windowed Application, you might consider a different metaphor. Perhaps look at how GoogleMaps uses a "virtual trackball" in the corner of the display?

                  Adam

                  Developer of LightUp Click for website

                  1 Reply Last reply Reply Quote 0
                  • P Offline
                    Pixero
                    last edited by 10 Aug 2010, 17:57

                    @adamb said:

                    However, in the context of a Windowed Application, you might consider a different metaphor. Perhaps look at how GoogleMaps uses a "virtual trackball" in the corner of the display?

                    Adam

                    Ok, but that's not what I want and wouldn't work in this case, simulating how a person looks at a scene, rotating directly in first person view somewhat like with your TourTool mode.

                    1 Reply Last reply Reply Quote 0
                    • P Offline
                      penpendrum
                      last edited by 14 Sept 2014, 11:43

                      Hello pixero.. And thomhom .. I have the same problem. I wonder if what is the code to run this win32api you just mentioned.. I also wanted to set the cursor on the center of the screen all the time even if I move the mouse. Do you have any sample ruby scripts to run this?

                      1 Reply Last reply Reply Quote 0
                      • D Offline
                        driven
                        last edited by 14 Sept 2014, 18:00

                        did you have a look at http://sketchucation.com/pluginstore?pln=InfinitePanOrbit

                        I did a mac hack to help out with it, is that the kind of thing your after?

                        john

                        learn from the mistakes of others, you may not live long enough to make them all yourself...

                        1 Reply Last reply Reply Quote 0
                        • 1 / 1
                        • First post
                          Last post
                        Buy SketchPlus
                        Buy SUbD
                        Buy WrapR
                        Buy eBook
                        Buy Modelur
                        Buy Vertex Tools
                        Buy SketchCuisine
                        Buy FormFonts

                        Advertisement