LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

move cursor to determinate coordinates


I want to do a program with Labview 8.0 that can be able to move the mouse cursor to a determinate coordinate.
The program has to read from two arrays, one which tell the cursor to move horizontally and the other one to move it vertically. Like this:
Horizontal array---> two possible values---> Left:0, Right:1
Vertical array---> two possible values---->Bottom:0, Up:1

I need just a simulation, so the array (1D) can have, for example, 10 values for each array , so the cursor would move ten times.

Well, with this introduction I can describe now what I´m not able to do.
I know how to move the cursor with SetCursosPos, but I don´t know how can I do this programatically.
I mean, for example, when you execute the program the cursor must be in the center of the screen and then it begins to read from the arrays so if it reads two '1' it means that the cursor has to move 'up' and 'right'. How can it moves to that direction??
The movement has to emulate the normal movement of the mouse, so it has to read from each element of the array each 1ms, for example, and it can´t jump from one coordinate to another, it can´t be abrupt movements. For this reason the increment on the coordinates has to be small.

I hope someone can help me.
Thank you.

Note:sorry for my english.


0 Kudos
Message 1 of 13
(4,106 Views)

Hello,

If you are talking about using an array containing a cluster of two number controls, one for the X increment and the other for the Y increment, then what I attached should solve your problem.  It uses some User32.dll stuff.  Hope it helps!

7J1L1M

0 Kudos
Message 2 of 13
(4,076 Views)
First of all thank you for your reply 7J1L1M.
The program you attached is OK, but it´s not exactly what I wanted.
I want the movement of the cursor to be continuous until you press stop.
In the example I attach, you can see four round booleans. The mouse cursor have to move to the different booleans. It has to begin with the one on the up-left corner until it arrives to the last one on the bottom-right corner. When it arrives to the last one it has to move again to the first boolean and do this until you press stop or quit.
I know that with the property node you can know the position of the booleans but I don´t know how to send this position to set the mouse cursor and do it with soft movements like in the example you attached and do it continuously.

Note: The programa I attach is just the same as yours but with the booleans
0 Kudos
Message 3 of 13
(4,062 Views)
Hay again,
 
I tried to open the file you attached, but it was made in LabVIEW 8.0, and I have LabVIEW 7.1.  Smiley Surprised
 
Could you compile it for 7.1?
 
By the way, are you saying the program makes the in between steps between two points and then carries them out continuously?  The last program I made I didn't realize that was what you wanted.  Sorry!  Anyway, please send me the program in LabVIEW 7.1 and give me an extended description of what you want.  Smiley Wink
 
7J1L1M
0 Kudos
Message 4 of 13
(4,060 Views)
I have attached the program in labview in 7.1, but if you cannot open because it´s still in labview 8.0 (I don´t know if I have done it right), it doesn´t matter. The only thing I´ve added are four round booleans in different positions forming a square.
I want that when you run the program the cursor must move to the boolean on the top-left corner, an go to the other three booleans until it arrives to the boolean on the bottom-right corner, and then return the top-left boolean and do the same again until you press stop.
The mouse cursor has to move continuously and softly from one boolean to another ´till you stop the program, that´s just what it has to do.
So the input array must be the different positions of the booleans instead of the array that you had on your program.

I hope I´d explained better.
It´s just that my english it´s not very good.Smiley Sad



0 Kudos
Message 5 of 13
(4,048 Views)

Hay again,

Sorry it has taken me so long to write back.  I am working on the code you requested though.  I'll send it as soon as possible.

7J1L1M

0 Kudos
Message 6 of 13
(4,031 Views)

Here is the program.  Sorry that it is hard to see and not very well spaced, but right now I am really hard pressed for time.  The functions themselves work great though.

By the way, the program uses a subvi that makes a line, which is how you would move smoothly between two points: make each pixel step, somewhat like LabVIEW's "Draw Line.vi" function, only I had to make a program that uses formulas to generate the coordinates...

Enjoy!

7J1L1M

0 Kudos
Message 7 of 13
(4,028 Views)
Hi 7J1L1M, thank you for your program, it´s really helpfull for me.
But when you move the scrolls in the main program the coordinates of the booleans change, and the movement it´s wrong.
This has to be because you use the property node of the panel bounds. Is there any way to use the coordinates of the screen and not the front panel ones?? So it doesn´t matter the size of the screen or if you move the scroll bars doesn´t affect the position of the booleans.

Thank you again for taking your time on this.
0 Kudos
Message 8 of 13
(4,015 Views)
When I made that part of the program, I knew that would end up happening and didn't like it.  But as for as I know that is the only way to the global screen coordinates of controls on a panel.  If I ever find another way, I will let you know.  I suppose that you could get the origin of the front panel and use that to offset the original position, then you could scroll all you want.  But for most programs, I don't suspect the user will be scrolling through the program.  Sorry!  Smiley Sad
 
Give the FrontPanel: Origin property a try and see if that can help you fix the measurements.  For now, as long the program is perfectly aligned so that (0,0) is in the top left corner, the program will work exactly.  It has been nice talking with you!
 
7J1L1M

Message Edited by 7J1L1M on 11-23-2006 07:39 AM

0 Kudos
Message 9 of 13
(4,009 Views)
Hi 7J1L1M, for me it´s been nice to talk to you too, you´ve helped me a lot.
But I´ve got another question.
I´ve attached two programs.
In the first one, a boolean moves depending to an array of numbers. So the program check if the first number is less than the second one, if it´s less(true), then the boolean moves to the right anf it´s greater to the left.
In the second program, I try to do the same but moving the mouse cursor, but the program stops because an error occurs, and I don´t know why
As you can see in the programs I only change the "left" position, but I´d like to change the "top" position too, as your program did. However, I don´t understand very well the algorithm and formula you used in your program.
The real thing I´d like to do, it wouldn´t be this. I mean, instead of reading from an array of numbers that tell the cursor where to move, I want to read from two channels of my acquisition card(usb-6009). Those two channels are two different signals of voltage. So when the voltage changes, the cursor has to move depending on the increase or decrease of the signal.

Well, I hope I´d explained as I really wanted. Smiley Happy
Thank you.
Download All
0 Kudos
Message 10 of 13
(3,965 Views)