LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

drag control example and how to save an indicator value??

Solved!
Go to solution

Hi everyone,

I want to drag boolean buttons on my front panel in the run time, how can I do it?

I remember I have seen an ni example for that, it's a card on the front panel, but I don't remember the name TT anybody knows?

 

and the second question is how to save an indicator value, like the first time you set the value and close the vi and run it again, the value will remain unless you change it in the second run time?

 

thanks in advance 

0 Kudos
Message 1 of 11
(4,258 Views)

Hi seafood,

you can use a property node to change the location of your front panel elements.

 

What do you mean with drag buttons on my front panel? You can't create front panel elements at runtime.

 

You can write the values to an ini/xml/... file.

 

Mike

Message 2 of 11
(4,247 Views)

As Mike says, you can use a property node to programmatically reposition controls on your front panel.

If you use an event case to detect the Mouse Down event on that control, then you can subsequently track the mouse coordinates and move the control until the Mouse Up event is detected. However, you'll need to carefully distinguish between the user simply wanting to select the control, ie change the value of a boolean, and wanting to begin a control move procedure.

Thoric (CLA, CLED, CTD and LabVIEW Champion)


Message 3 of 11
(4,243 Views)
Solution
Accepted by topic author seafood

thank you both, is there any good examples of mouse tracking event structure available?

 

and my second question is for example: I read a file using the vi i created the first, which set all the button positions on the front panel, and the 'get file extension vi' shows the file name on the front panel. then i close the vi and open it again, the button positions is still where they are, but the file name string indicator is empty.

how can i save the file name indicator so when i open that vi again, if no selection of other button position file, the file name indicator still shows the previous name?

0 Kudos
Message 4 of 11
(4,237 Views)

THe attached (in LV 8.6) is a quick and dirty dragging example.

 

 

When a mouse down event is detected the offset between the mouse and the top left corner is calculated and cached in a shift register.

 

Mouse moves use the offset to etermine the new location.

 

Mosue up clears a boolean used to track if we are actively dragging at the moment.

 

Have fun!

 

Ben

Message Edited by Ben on 04-15-2009 07:54 AM
Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Download All
Message 5 of 11
(4,227 Views)

that's great! now I just have to figure out how to apply this to 96 buttons ....

thanks alot

0 Kudos
Message 6 of 11
(4,203 Views)

Hi seafood,

in this case you can use dynamic event registration and work with references inside the event structure. No need to create more event cases.

 

Mike

Message 7 of 11
(4,198 Views)
by Ben on 04-15-2009 10:00 AM
Message Edited by Ben on 04-15-2009 10:00 AM
Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 8 of 11
(4,196 Views)

Smiley Surprised

Hi Mike

I have never used 'dynamic event registration' before, can you tell more detail about it?

0 Kudos
Message 9 of 11
(4,183 Views)

Hi seafood,

see the attached example.

See also this link for an easy way to get all the references you need.

 

Mike

Message 10 of 11
(4,159 Views)