LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Declaring variables in LabVIEW

Hi Freelance LV, 

 

I apologize. I did not see this reply. I have gone over the tutorial and the example you've given me. I greatly greatly appreciate the work you put into that file. I modified my file to be similar to yours. However, just one more question. How can I get the "Coords" on the sub-panel to stop updating when the mouse cursor is no longer "inside sub panel?" Is this task possible? 

 

Thank you again! 

0 Kudos
Message 11 of 18
(878 Views)

Hi

 

As long as the mouse is moving, the event will generate the cooridnates, irrespective of it being inside or outside the sub panel.

 

If you put a case strucutre at the output on In Range function, you can have the indicator inside the case structure. So, the coordinates are displayed only when the mouse is inside the sub panel.

 

Else, the event keeps occurring and the coordinates are displayed.

 

suggest use mouse down event, though.

 

accept solutions if your problem is sovled.

 

Edit: Here you go.. look at the attachment

Regards
Freelance_LV
TestAutomation Consultant
0 Kudos
Message 12 of 18
(867 Views)

thank you. I edited the file you gave me and it worked. 

I tried doing the same with my file, but I realized that my my case structure's selector terminal is already connected to a case switch. 

I tried connecting the output of the range function the selector, but it wouldn't work. 

 

Would I need to recreate a new case strucuture? Though, I would still need to keep the three events 0, 1, & 2. 

 

 

0 Kudos
Message 13 of 18
(860 Views)

You cannot connect two wires to the same case terminal.

 

use either case structure inside, or, a condition function

Regards
Freelance_LV
TestAutomation Consultant
0 Kudos
Message 14 of 18
(853 Views)

thank you again!!! 

 

But I hope these will be my last questions. What do you mean by "Local Mouse Coord Prev" mean? This represents the false case but what does prev mean?

I created a value property node and called it the same thing and it now works great. 

And also, on the in range indicator, I'm still a bit confused. What does the left and run indicators mean? Because when I move the cursor to the left/right outside of the sub-panel, the top indicator goes on. And when I move it to the top/bottom, the left indicator goes on? 

 

Lastly, I tried reconnecting everything the same way to case 2 as it is for case 1. But when case 2 is run, the program always crashes. Could it be due to the system I am running?

0 Kudos
Message 15 of 18
(845 Views)

I created another indicator, to hold the previous value of the Local Mouse Coord, in your case. This is an example.

 

You could as well use a shift register to hold the value of Local mouse coord, from the previous iteration. So, you have the current value of the coordinates from the mouse move event and the previous iteration value from this indicator. if the in range function returns a true value, that means your mouse is within the limits. so write the current coordinate value. for the next iteration, this would become the 'previous' value, so update the local mouse coord previous indicator too.

 

if your mouse is not within the sub panel bounds, you will write back the previous iteration value.

 

the simpler way is to put another case structure inside each case of your exisitng code, then wire the 'in range?' result output to it. But i do not prefer nested case structures.

 

 

next.. Left is the position of your mouse from the leftmost point on the FP. Top is the position of your mouse from the top border of the front panel. This, if i am right, is in pixels. so a mouse position say )17,28) is 17 pixels from left, 28 pixels from top.

 

In your Sub panel start and end positions, you get the coordiantes of the sub panel, similar to the values in your first post. 

 

when you are comparing your coordinates with the start position and end position of the sub panel, you can do it in two ways...

 

check if both the (x,y) coordinates of the mouse are between start position say (a,b) and end position say (m,n) of the sub panel. so you check for a<x<m (left coordinate) and b<y<n (top coordiante) as in your first post. This will give you two boolean outputs, as you see in the cluster output of In Range. your mouse is inside the sub panel ONLY if both the boolean are True. So put an And function there.

 

This is called Compare Elements. Right click on the In Range function, see the Comparison Mode.

 

The second way to compare is to see if either x or y is within the limits... that is an OR funciton and you can select Check Aggregates mode of comparison.

 

Hope it is clear why you have

 

Regards
Freelance_LV
TestAutomation Consultant
0 Kudos
Message 16 of 18
(840 Views)

This may be a pretty late reply, but Freelance_LV or anyone else... would you happen to know why my program crashes? Whenever I run my program from the front panel, it runs perfectly for Case 1. However, when I enter a 2 for Case 2... the enetire program shuts down. I haven/t gotten the opportunity yet to try the program on another computer... but could my computer be the reason? I'm currently using a MacBook Pro. 

 

My many thanks in advance! 

0 Kudos
Message 17 of 18
(800 Views)

Please post your latest version along with the subVIs.  I will try it on my Macs.

 

Lynn

 

Using LV on the Mac since version 1.2

0 Kudos
Message 18 of 18
(776 Views)