LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

"Mouse Down" & "Mouse Down?" in Event Structure...

Hi everyone!

I am creating a meter using input "OK Button" and output "Gauge". I am using Event Structure, when I use mouse press down the OK Button, the Gauge will increase its reading automatically. If I release the OK Button, that means mouse up, the Gauge stop at once.

What should I do???

P.S.
I would like to ask the difference between "Mouse Down" & "Mouse Down?". What is the meaning of adding a question mark at the end of the command?
0 Kudos
Message 1 of 13
(5,614 Views)
Since a while loop containing an event structure will only iterate when an event occures, you will either need to use a timeout event to do this or do it in another loop.
BTW, from your description, it doesn't sound like you need an event structure at all. Just use a while loop like in the picture. Make sure the mechanical action is "latch until released".
The difference between the events is explained if you click help - a question mark means you can discard the event if you choose to.

Message Edited by tst on 03-17-2005 11:12 AM


___________________
Try to take over the world!
0 Kudos
Message 2 of 13
(5,596 Views)
Hi tst!
Thank you for your reply.
I afraid You have misunderstood the control style of my ideal panel.
I use only one button in the control panel.

Firstly, I point the mouse cursor on the OK Button.
Seconly, I keep pressing down the left key to run the gauge.

If I release my finger from the mouse key, the gauge stop at once.

Any idea???
0 Kudos
Message 3 of 13
(5,589 Views)
The code in the picture does exactly what you ask for. If you set the mechanical action to be "Latch Until Released", the value will be T as long as long as you hold down the mouse.

___________________
Try to take over the world!
0 Kudos
Message 4 of 13
(5,585 Views)
Hi tst!
Thanks for your reply!

I understood the solution you provided, I have tried this before.
However, the end functions of my ideal Boolean button is including
"Latch Until Released" and "Switch When Pressed" two mechanical actions.
I don't know how to combine two mechanical actions together???
So I choose event structure to create my LabVIEW program.
0 Kudos
Message 5 of 13
(5,562 Views)


@askjdhvl wrote:
Hi tst!
Thanks for your reply!
However, the end functions of my ideal Boolean button is including
"Latch Until Released" and "Switch When Pressed" two mechanical actions.

. This does not quite make sense. Can you explain in more detail?

If you want to use an event structure, you could increment your gauge in the timeout event. The "mouse up" and "mouse down" event would then switch the current timeout between infinite and finite, resp.

See attached example (LabVIEW 7.0)
0 Kudos
Message 6 of 13
(5,552 Views)
Events with question marks are so called "Filter events". They are handled differently to "notify events".

The online help probably explains it best:
There are two types of user interface events—notify and filter. Notify events are an indication that a user action has already occurred, such as when the user has changed the value of a control. Use notify events to respond to an event after it has occurred and LabVIEW has processed it.
...
Filter events inform you that the user has performed an action before LabVIEW processes it, which allows you to customize how the program responds to interactions with the user interface. Use filter events to participate in the handling of the event, possibly overriding the default behavior for the event. In an Event structure case for a filter event, you can validate or change the event data before LabVIEW finishes processing it, or you can discard the event entirely to prevent the change from affecting the VI. For example, you can configure an Event structure to discard the Panel Close event, preventing the user from interactively closing the front panel of the VI. Filter events have names that end with a question mark, such as Panel Close?, to help you distinguish them from notify events. Most filter events have an associated notify event of the same name, but without the question mark, which LabVIEW generates after the filter event if no event case discarded the event.

0 Kudos
Message 7 of 13
(5,548 Views)
Hi altenbach!
Thanks for your reply.

The end function of my control, one Boolean button includes "Latch Until Released" and "Switch When Pressed" two mechanical actions at the same time. It is because I am creating a LabVIEW simulator of a real lighting product.

This product includes buttons.
When the light is OFF, I press once then the light ON, or I press long then the light ramp ON.
If the light is ON, I press once then the light OFF, or I press long then the light ramp OFF.
Above functions only occur in only one button. Of cause all buttons on the lighting product have same functions.
0 Kudos
Message 8 of 13
(5,514 Views)
I'm still confused, but let me see if I got it right.
You have one button. You want it to control both a light and a light ramp. You want the light to be turned on and off whenever you click the button (only shortly?) and you want the light ramp to change states only when the click is long? If so, that's different from you originally asked for. You will need to modify Altenbach's solution by reading the time data in the mouse up and down cases and by subtracting the down from the up (use shift registers) you will get the amount of time the mouse button was down and you can decide what to do (use NOTs with shift registers to decide whether to turn on or off. You will also need to modify the timeout case.

___________________
Try to take over the world!
0 Kudos
Message 9 of 13
(5,506 Views)
Hi tst!
Thanks for your reply!

You get it! This is my true meaning!
I have to apologize about my bad presentation.
0 Kudos
Message 10 of 13
(5,277 Views)