Jump to content

mouse buttons to control booleans


Recommended Posts

:blink:

i haven't found anything on this topic, but i thought someone might know -

is it possible for me to assign mouse buttons to booleans? (in LabVIEW 6.1)

i have a start and stop button in my program and want to make the left button click activate the start button and the right activate the stop - possibly assign the mouse wheel to a third button

i'd love it if anyone could help me out with this.

thanks...

jess

ps: orange button = start

"stop" = stop

Download File:post-2309-1117562866.vi

Link to comment

Here is how you would do it using the event structure.

Select Vi with the mouse up option

post-584-1117595581.png?width=400

Wire off of the button terminal for start or stop.

The mouse cursor must be over the front panel when the mouse is clicked

in order for the event structure to pickup the event.

post-584-1117595611.png?width=400

As for making it work in you attached vi thats another issue.

You may want to consider using a state machine or other method to organize your code.

Link to comment
As for making it work in you attached vi thats another issue.

yeah, that's the problem - i am not sure if it is possible to do that within my setup - i tried looking at lots of different case structure examples and wasn't sure if it was possible within my program

- the program works the way that i want/need it to, but my advisor wanted me to try to set it up so that we could start and stop it by clicking different mouse buttons - we need to operate the program from a distance, and we're using a very small laptop so if we can start/stop our program without being able to see the screen, it is ideal...

You may want to consider using a state machine or other method to organize your code.

i am not sure what this is or how to do it... any suggestions? i have only been using labview since January 2005, and never had to use it extensively until now.

thanks for the help! i appreciate it. :thumbup:

Link to comment

Here is a Demo program that shows how I would approach this program.

First separating the User interface from the Processes by using separate loops

Next Use a state machine to separate out each process and Daq event.

Finally tranfer commands between the 2 loops by using a Que.

Download File:post-584-1117644639.llb

Hope this isn't too far over your head.

This is my favorite type of structure and I use it in various forms for all of my programs.

Link to comment
  • 3 weeks later...

If you want to detect the mouse click without an event, you should use the Input Device VIs in the advanced palette.

Place a Mouse Init VI to get a connection to the mouse and wire the connection into Acquire Input Data. You will get a cluster telling you which buttons are pressed.

You will have to do this by polling.

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.