LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

dynamically register event mouse move

I try to understand dynamically register for events.
In this NI example of "Dynamically register for events.vi",  the first register events (outside the while loop), if I change the top item "mouse move" to something else, I cannot select "mouse move" event anymore, in the pull down arrow, there is not a "mouse move" as a selectable item. 
Can anybody explain this?  I have to close VI without saving.
When I make change to the event, in the event structure, there will be a case "unknown event" displayed.

My other question is: how does the program knows the difference between mouse outside the picture control?
I know that when I press the mouse button down on the picture then the iteration starts to count,  I just don't understand how the program knows the difference, it is not obvious to me.

regards
0 Kudos
Message 1 of 9
(4,487 Views)
 

You should try working with standard events before using dynamic events.

As for your questions:

The dynamic events available in the event structure are determined by the dynamic event terminal (inside the right red square in the image below). When you change the Mouse Move event, it is no longer available and you have to configure the event structure to use another event.

The Mouse Up and Mouse Down? events are registered for all the controls (left red square), so clicking on any control would generate those events.

There should be a tutorial on this site about using dynamic events. You can use the search engine to find it. Also, reading the LabVIEW help on this is a good idea.

To learn more about LabVIEW, I suggest you try searching this site and google for LabVIEW tutorials. Here, here, here, here and here are a few you can start with and here are some tutorial videos. You can also contact your local NI office and join one of their courses.
In addition, I suggest you read the LabVIEW style guide and the LabVIEW user manual (Help>>Search the LabVIEW Bookshelf).


___________________
Try to take over the world!
0 Kudos
Message 2 of 9
(4,477 Views)
Hi
 how does it know the mouse is inside the picture control?

regards
0 Kudos
Message 3 of 9
(4,471 Views)
Again, the up and down events are registered for ALL the controls, including the picture.
This is done by using the Controls[] property, which is an array of reference to all the controls on the front panel.

___________________
Try to take over the world!
0 Kudos
Message 4 of 9
(4,468 Views)
In my application, i need to stop the compressor
when the measured pressure reaches a set limit
so I acquire the analog pressure value and
 do a compare with max limit pressure

and write a digital output bit to a DAQ card  to turn off the
compressor.

I do have a control "True/False" boolean for running the compressor
but the operator can stop the compressor  AND the program can
stop the compressor.

avoiding dynamic event as suggested
can I use static event to stop the compressor?

Message Edited by trout00 on 01-24-2007 09:07 AM

0 Kudos
Message 5 of 9
(4,451 Views)

A couple of suggestions:

The easy way is to create a property node for your boolean and use the Value (Signaling) property. This property will cause Value Change events to fire whenever you write to it. Note that you will have to change the mechanical action of the boolean to a switch one and use a local variable to reset it.

A better way is to create a state machine. There are some examples under the Design Patterns section of the File>>New dialog.
In this case, you will create a Stop Compressor state and simply call it from both places.


___________________
Try to take over the world!
0 Kudos
Message 6 of 9
(4,446 Views)
if i use state machine, am I stuck with a polling system?
 
I use state machine before this , and have 18 boolean switches on the front panel for user interface.

in a normal system, user set a few boolean switches then operates the compressor,.....
and hope that the programmer has something to stop the compressor before fireworks!!!

operator may control 18 switches at different times during the process, I use polling and queue to do this in LV 5.1

event structure is the answer,  I hope.

Should I go back to state machine?


0 Kudos
Message 7 of 9
(4,443 Views)

You can use an event structure in a state machine in one of two ways:

  1. Create a UI polling state and use the timeout event to switch to other states if the user did nothing. This is polling, but it's more organized. Note that the event structure will only respond when the state machine gets to that state, so if you have another state which takes five minutes to complete, your state machine will become unresponsive.
  2. Use seperate loops. Have one loop for the UI and another for the state machine and communicate between them by using queues.

You really should look at those templates I mentioned, as they show how to do this.


___________________
Try to take over the world!
Message 8 of 9
(4,439 Views)
Another thread discusses your original issue at:
http://forums.ni.com/ni/board/message?board.id=170&message.id=158646&jump=true#M158646
0 Kudos
Message 9 of 9
(4,074 Views)