Welcome Guest ( Login | Register )



All times are UTC - 7 hours [ DST ]



Post new topic Reply to topic  [ 6 posts ] 
Author Message
 Post subject: Position of the cursor
PostPosted: Wed Mar 27, 2013 9:52 am 

Joined: Tue Sep 18, 2012 4:53 am
Posts: 27

Offline
Hi,
is there any way to determine the current position of the cursor ("sometimes visible") on the screen; coordinates x, y?
-> T15B or RunTime ...

Thanks for reply

Joe


 Profile  
 
 Post subject: Re: Position of the cursor
PostPosted: Wed Mar 27, 2013 12:09 pm 
User avatar

Joined: Thu Nov 29, 2012 2:27 pm
Posts: 92

Offline
Sure, it shouldnt be a problem...

I´m home right now so can´t try it on a panel but following should work.

If you want it in "Point" format

var cursorPos = System.Windows.Forms.Cursor.Position;

You can then access X/Y like this

int cursorPosX = cursorPos.X;

Or if you want X/Y as two INT:

var cursorPosX = System.Windows.Forms.Cursor.Position.X
var cursorPosY = System.Windows.Forms.Cursor.Position.Y

Best Regards

_________________
Edmund Andersson

AITECH AB

Part of Beijer Integrator Group


 Profile  
 
 Post subject: Re: Position of the cursor
PostPosted: Thu Mar 28, 2013 12:30 pm 

Joined: Mon Mar 11, 2013 8:48 am
Posts: 13

Offline
I was trying out a form popup utilizing this cursor position example. Things work dandy through debugging and running the code on Visual Studio with the output CF. But I get the error in the image below when I try and simulate the code in iX Devloper even though the "intelligent code completion" picks up on it. Any thoughts?

Also in just trying to do a pop up form, my end device (QTerm A7) locks up and restarts within a couple of second. Even something as simple as a MessageBox.Show has the same result. Any Ideas?

Thanks in advance.
-Joey


Attachments:
Error.jpg
Error.jpg [ 10.23 KiB | Viewed 2258 times ]
CodeSnippet.jpg
CodeSnippet.jpg [ 68.18 KiB | Viewed 2258 times ]
 Profile  
 
 Post subject: Re: Position of the cursor
PostPosted: Thu Mar 28, 2013 12:42 pm 

Joined: Tue Mar 13, 2012 9:53 am
Posts: 824

Offline
If you switch your target to a PC, I bet your error will go away. If it does, it means that the code complete is using the .NET libraries rather than the Windows CE .NET libraries.

I have found that the code complete often times does than. The .NET Compact framework most likely doesn't have the Position property.

_________________
Best Regards,
Mark Monroe

Beijer Electronics, Inc. | Applications Engineer


 Profile  
 
 Post subject: Re: Position of the cursor
PostPosted: Thu Mar 28, 2013 1:31 pm 
User avatar

Joined: Thu Nov 29, 2012 2:27 pm
Posts: 92

Offline
Sorry Jwphilippi, I didn´t mean try to fool you :oops:

I was simulating in a T12C project (looks just lika a T15B in the IDE).

Try use this instead and see if it works

Code:
var cursorPos = Control.MousePosition;
Text1.Text = "X = " + cursorPos.X + " / Y = " + cursorPos.Y;



Regards

_________________
Edmund Andersson

AITECH AB

Part of Beijer Integrator Group


 Profile  
 
 Post subject: Re: Position of the cursor
PostPosted: Thu Mar 28, 2013 2:16 pm 

Joined: Mon Mar 11, 2013 8:48 am
Posts: 13

Offline
Thank you Mark and Thank you Edmund. I am astounded by ya'lls awesomeness when it comes to programming these HMIs.


 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 

All times are UTC - 7 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron