LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

initialize control to value (not necessarily default)

Is there a way to set a control to a specific initial value but then let the contol be changed and work normally?  I realize that one can set a default value for a control but the initial value for my application changes based on some other parameters.  Basically some inputs determine an intial value for a numeric control and some other options make that control visible when appropriate.  The user then may use the inital value or make changes to the control based on what is needed.
 
Any help is appreciated-
 
Thanks,
 
Nathan
0 Kudos
Message 1 of 9
(4,479 Views)
Is this what you're looking for?
 
Albert
0 Kudos
Message 2 of 9
(4,466 Views)
So why not just set the control to whatever value you want after determining what the initial value should be? You can do this with a property node as albertm posted, or by using a local variable. What it looks like you're asking is just how to set a control to a value, is there more to it than this?
0 Kudos
Message 3 of 9
(4,460 Views)
Albertm,
 
Your metheod works, but only once.  I need to be able to continually set an initial value to a control and then be able to change it.  My application uses cursors on an image to define coordinates and then changes the pixel locations of the cursors to centimeters.  The control I am talking about lets the user select where to take a "slice" of the image.  Initially I want the slice to be at the center of the image (in centimeters).  The user should then be able to change the numeric control to change to position of the slice.
 
If the user wishes to change to cursors (and hence the pixels to cm scaling factor) then the initial value of the slice control will need to change.
 
 
0 Kudos
Message 4 of 9
(4,449 Views)
Marc A,
 
If you have the property node and the control in the same while loop you can't change the control via the front panel anymore. 
0 Kudos
Message 5 of 9
(4,444 Views)

Albertm,

 

Found your solution works more than once if the "other value" control is placed inside the while loop.

 

Thanks, I'll give the event structure a try.

 

Nathan 

0 Kudos
Message 6 of 9
(4,440 Views)
Well it depends on when you set the value. If you have 1 while loop continuously setting the value of a control through a property node or local variable, then of course you'll never be able to change it.
 
What I would suggest is to use an event structure with a button, like albertm suggested, or you can use the cursor move event. Then, when a user grabs the cursor and moves it, you can perform whatever calculation you need and reinitialize the control. This is what I would do, and have done in the past. You won't have to rely on the user pressing a button to reinitialize the control every time they move the cursor.
 
Edit: I misread some of your description. If you're doing this on a picture and drawing your own cursors, you won't be able to use the event I mentioned. It is for a graph. Sorry about that.

Message Edited by Marc A on 12-06-2006 04:03 PM

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

hi, quick question for you guys, instead of just doing one control, are we able to initialize a "control array" with the same method??

 

 

kevin.

0 Kudos
Message 8 of 9
(4,048 Views)
Hi Kevin,

You can just create a local variable for your array, and set it to "write".
Regards,

Jeremy_B

Applications Engineer
National Instruments
0 Kudos
Message 9 of 9
(4,026 Views)