Go to Post Removing too much of the challenge removes too much of the accomplishment when you solve the problem. Removing too much of the challenge removes too much of the innovation in the solutions... removing too much of the challenge removes too much of the fun. - dlavery [more]
Home
Go Back   Chief Delphi > Technical > Programming > NI LabVIEW
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
 
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 28-11-2009, 17:01
kamocat's Avatar
kamocat kamocat is offline
Test Engineer
AKA: Marshal Horn
FRC #3213 (Thunder Tech)
Team Role: Mentor
 
Join Date: May 2008
Rookie Year: 2008
Location: Tacoma
Posts: 894
kamocat is just really nicekamocat is just really nicekamocat is just really nicekamocat is just really nicekamocat is just really nice
Send a message via AIM to kamocat Send a message via MSN to kamocat
Trouble with mouse location on pictures

I'm trying to use the mouse to draw rectangles on a Picture indicator.
However, the mouse coordinates are not corresponding consistently to the Rectangle coordinates, and I can't seem to make sense of it.

Here's a video demonstrating the problem.
http://screencast.com/t/Yzg1YTViYWUt
While you can't see whether I'm clicking or not, every short diagonal movement is a click-and-drag action.
(In one of them, I believe the rectangle it made was actually outside the picture).


Is there anything wrong with my code?

(Note:
I am using the Picture control, not at IMAQ image. This code is not intended to run on the cRIO, and probably won't be usable within the FRC Framework)
Attached Files
File Type: vi Picture properties.vi (34.1 KB, 35 views)
__________________
-- Marshal Horn
Reply With Quote
  #2   Spotlight this post!  
Unread 28-11-2009, 17:06
daltore's Avatar
daltore daltore is offline
Electronics/programming/design
AKA: Aaron Osmer
FRC #3529 (ausTIN CANs)
Team Role: Mentor
 
Join Date: Dec 2007
Rookie Year: 2007
Location: San Antonio, TX
Posts: 272
daltore has a spectacular aura aboutdaltore has a spectacular aura aboutdaltore has a spectacular aura about
Send a message via AIM to daltore Send a message via MSN to daltore Send a message via Yahoo to daltore
Re: Trouble with mouse location on pictures

Hey, that's a neat trick. Are the XY coordinates you're getting from the mouse within the frame, within the window, or within the entire screen? Also, what's the scope of the rectangle creation (same scopes as above)? I'm guessing you've already set that up correctly, but if it's not doing what it's supposed to be doing...
Reply With Quote
  #3   Spotlight this post!  
Unread 28-11-2009, 20:23
kamocat's Avatar
kamocat kamocat is offline
Test Engineer
AKA: Marshal Horn
FRC #3213 (Thunder Tech)
Team Role: Mentor
 
Join Date: May 2008
Rookie Year: 2008
Location: Tacoma
Posts: 894
kamocat is just really nicekamocat is just really nicekamocat is just really nicekamocat is just really nicekamocat is just really nice
Send a message via AIM to kamocat Send a message via MSN to kamocat
Re: Trouble with mouse location on pictures

Okay, I found several problems:
The X and Y axis were switched when creating the rectangle.
The picture origin was not correct (thus creating a consistant offset)
The correct picture origin is dependent on the picture position plus a fixed offset.

Anyways, I got it working correctly, and uploaded it in case you wanted to see too.

Thanks!
Attached Files
File Type: vi Picture properties.vi (38.4 KB, 17 views)
__________________
-- Marshal Horn
Reply With Quote
  #4   Spotlight this post!  
Unread 28-11-2009, 22:54
RoboMaster's Avatar
RoboMaster RoboMaster is offline
Alum, former programmer&co-captain
FRC #2472 (The Centurions)
Team Role: Mentor
 
Join Date: Apr 2008
Rookie Year: 2008
Location: Minnesota, Twin Cities
Posts: 268
RoboMaster has a brilliant futureRoboMaster has a brilliant futureRoboMaster has a brilliant futureRoboMaster has a brilliant futureRoboMaster has a brilliant futureRoboMaster has a brilliant futureRoboMaster has a brilliant futureRoboMaster has a brilliant futureRoboMaster has a brilliant futureRoboMaster has a brilliant futureRoboMaster has a brilliant future
Re: Trouble with mouse location on pictures

Oooh, these are always great fun!

NI has tons of examples for these picture controls. They're of course on NI Developer Zone, but if you look up picture controls and the like in the LabVIEW Help, they will have examples there too to look at. Lots of cool ideas.

Glad it worked!
__________________
My engineering blog: noeticbrainwaves.blogspot.com

I'm not slacking, my code's compiling
...and I'm using LabVIEW
Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Possible confusion between competition location and shipping location rl1806 General Forum 2 07-02-2009 00:27
Trouble with Autonomous popnbrown Programming 15 27-02-2007 20:48
Optical Mouse / Ball Mouse Clark Gilbert Chit-Chat 26 22-07-2004 13:17
Trouble with pwm outputs misterikkit Programming 16 17-01-2004 10:56


All times are GMT -5. The time now is 11:54.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi