LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

reading and writing to the same place

I'd like to read from a string window then clear the text and change the window from an indicator to a control. I think I'm on the right track but had trouble. If I can do what I like, would somebody please finish this vi for me or point me in the right direction.
thanks
0 Kudos
Message 1 of 10
(2,709 Views)
You cannot change a control to an indicator or an indicator to a control during runtime.  Your property node generates an error because you try to set it during runtime.

What is the goal you are trying to accomplish?  If you don't want the user to be able to interact with it until you fill it, then use the Disabled property and wire a 1 or 2 to it to disable, or disable and gray out the control.  When you want the user to be able to use the control,  use the same property and wire a 0 to it.
0 Kudos
Message 2 of 10
(2,703 Views)
I'm trying to save real estate. First I want to read from a file; then I want to write to it, all while it is running.
0 Kudos
Message 3 of 10
(2,699 Views)
I am assuming the user needs to see all of this?

If you are writing to the file, where is the data coming from?  Is the user changing something in the file which then gets resaved?

If this is a subVI which the user never sees, then it doesn't matter if you have two big text blocks on the screen, or if you have two tiny ones.

When you read from the file, you can use a local variable or the Value Property node to set the value of a control.
Message 4 of 10
(2,696 Views)
Thanks.
I'm adding to the file but not using a sub vi. I don't like sub vi's but may have to go that route.
0 Kudos
Message 5 of 10
(2,684 Views)
"I don't like sub vi's"

You've said this before, and you really need to get over this. Modular programming is the proper way to program. Just pick up any programming book. A subVI is the same as a function.
0 Kudos
Message 6 of 10
(2,674 Views)
I may have become a better programmer so that if I tried sub vi's again I might come up with a new opinion about them.
I learned to dislike them because I didn't like the fact that they ran when they opened and many times I didn't want that. I think I know how to get around that now.
I also never liked them because, as I remember, it was a large pain if I ever had to change a vi deep within a program.
And finally, maybe I never figured out how, but making the sub vi and then re wiring into a program always seemed like not worth the effort.

If I were using the same sub vi over and over in different vi's it might be a different story. Working with a team, we wrote a vi about 3 or 4 years ago. This is the first time since that we are back to LabView. I find my program readable; so far it works; neither speed nor memory hasn't been a problem; so I see no reason to make sub vi's.

Doug
0 Kudos
Message 7 of 10
(2,665 Views)
You can't actually change what an object is, but there are a couple options. First, you can make an indicator appear to operate like an indicator but setting it to be disabled but not grayed-out and using a property node to write to it. Second, you can create a control and an indicator that occupy the exact same space and are the same size. Then when you want the indicator function turn the control invisible and the indicator visible. Then when you want the control make it visible and the indicator invisible. If the two objects are exactly the same size and in the exact same location at run time it will look like the object is changing back and forth between being a control and an indicator.

Mike...

Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
Message 8 of 10
(2,658 Views)
Thanks, you're a genius.
0 Kudos
Message 9 of 10
(2,643 Views)
Yes, well, it's not my intent to hijack this thread, and I'm certainly not going to change how I program based on your comments on why you don't like subVIs, which don't really have much to stand on. When I hear those kinds of comments (which isn't the first time), they're more indicative of a poorly designed program/hierarchy, sorry to say.

One comment I do need to say: SubVI do not "automatically" run when opened unless they're configured that way. You're probably confusing the run state of a subVI that's in a hierarchy when the main program is running. In this case the run arrow can't be clicked on - this does not indicate the VI is running unless the arrow is black. If the main VI is running and you open a subVI the arrow will look like two arrows inside each other. This indicates that the subVI cannot be run independently, as the main VI is running. This is explained in the LabVIEW documentation.

All that I can say is that hopefully you pick up some good LabVIEW programming habits over time, and that will help you write VIs in such a way that your objections become non-existent.
Message 10 of 10
(2,630 Views)