LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How can I make controls save their state when the project is closed?

Solved!
Go to solution

Hi there,

 

Im currently doing an aplication and i have the sa e condition as u. My idea was to create a txt with all paths and control inputs that i need and use them as standard inputs. so i dont need to configure anything everytime i run the program, only if i input a new value it will update. maybe there are better ways 😄

 

complements

0 Kudos
Message 21 of 43
(633 Views)

@asnaev wrote:

Hi there,

 

Im currently doing an aplication and i have the sa e condition as u. My idea was to create a txt with all paths and control inputs that i need and use them as standard inputs. so i dont need to configure anything everytime i run the program, only if i input a new value it will update. maybe there are better ways 😄

 

complements


The easiest, most strightforward way is to use a file to store your settings, linke your test file or an ini file.

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 22 of 43
(626 Views)

@DroidFreak wrote:

That looks simple, but you're forgetting the fact that LabView has hundreds of modules and I have absolutely no idea how to find those particular modules just by seeing a picture of them (or even seeing them in someone else's program). If this were text code I could easily copy it verbatim, but as it is it doesn't help me because I still have no clue how those modules are found.

 

Here's what I really need: A detailed explanation of where to find the modules to write to a control, to read/write from whatever file type can store numbers and strings best, and to make something execute after a loop. I can figure out the details of the module layout myself, that's programming and that's what I do. What I can't do very easily is find things in LabView's web of menus.


Actually, with snippets, you CAN pretty much copy things verbatim.  Well, "import" or whatever.  You probably think we all learned where everything is by taking courses, but really the easiest way of finding what you need is to open up the main palette and click on the <Search> button.  Type in a keyword or two describing what you are trying to do.  Do that enough times and you start knowing where everything is.  Kind of like when you learn a text-based language, you have to look up keywords that you don't already know.

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 23 of 43
(620 Views)

Configuration files (ini) are the most robust option.  you can design your code to load a default ini at start up.  Then, if you so desire, you can give users the option to save current settings to their own custom file.  A second button will load a user file to update all relavent controls.  Such a set up is ideal for cases where users 1,2,3, etc all have different settings they use when running the code.  If everyone uses the same settings, however, just the default file will be sufficient.

 

Save the default file in the same folder as your vi and wire a relative path to the config vi functions (avoids problems if someone moves the folder).

0 Kudos
Message 24 of 43
(617 Views)

Yes you can make an aplication directory and it will find ur file allways if you move ur program to another directory or folders. Just keep the file in the same place inside ur folder appl.

 

0 Kudos
Message 25 of 43
(612 Views)

@asnaev wrote:

Yes you can make an aplication directory and it will find ur file allways if you move ur program to another directory or folders. Just keep the file in the same place inside ur folder appl.

 


This is no longer the recommended way of doing things.  Because of Windows security normal users don't have access to modify files under Program Files folder.  If your application is installed there and the config files are with it, you will not be able to modify the ini file unless you have the correct privlages.  The more correct way is to store the settings under Application Data.  This is less intuitive because a config for an application is hidden from the user, but more secure.

0 Kudos
Message 26 of 43
(607 Views)

Ok, I figured out how to make things execute seqentially. Now I just need to figure out how to write to a control and how to read and write INI files.

0 Kudos
Message 27 of 43
(599 Views)

@DroidFreak wrote:

Ok, I figured out how to make things execute seqentially.


Are you using a sequence structure? If so, you're making one of the classic new LabVIEW user errors. You want to use wires to control execution flow.

0 Kudos
Message 28 of 43
(596 Views)

"You want to use wires to control execution flow."

 

Why? Are you telling me that LabView is completely counterintuitive like I've been saying all along? And how am I supposed of control execution with wires?

0 Kudos
Message 29 of 43
(588 Views)

@DroidFreak wrote:

"You want to use wires to control execution flow."

 

Why? Are you telling me that LabView is completely counterintuitive like I've been saying all along? And how am I supposed of control execution with wires?


I'd say it is quite intuitive, a C call function call doesn't return a value until that function is completed.  Just like a subVI will not return any of its values until it is completed.  You can force data flow by not allowing a subVI to execute because it requres an input from an output of another subVI.  This way you will know that the second subVI will not start execution until after the first completes.

0 Kudos
Message 30 of 43
(585 Views)