Jump to content

Dynamic default settings of controls


Recommended Posts

Hi all,

is there a way how to assign defaults to controls programatically?

I mean, every time I launch the program (subVI in my case) I need the

controls to be set to values used in previous run of the program.

I have tried the Make current values default method after once controls were set,

but the error message popped up saying I only can use this method in Edit mode.

Would anybody gimme a hint

Thanks

Michal

Link to comment
Hi all,

is there a way how to assign defaults to controls programatically?

I mean, every time I launch the program (subVI in my case) I need the

controls to be set to values used in previous run of the program.

I have tried the Make current values default method after once controls were set,

but the error message popped up saying I only can use this method in Edit mode.

Would anybody gimme a hint

Thanks

Michal

4784[/snapback]

Hi Michal,

what kind of controls do you mean?

You can save values as default if you go to the toolbar -> complete -> set values as default.

Edit: If you want to set some controls e.g. switches to true, you need to create a local variable of this control. This variable should be changed into "write" (right click on the variable) and wired to a true constant (boolesch)

Link to comment

Every run of program, I set values on controls (numerical ctrls) - different from run to run.

All I need - when I run program every next time - is that the controls values turn up as they were

the last time of program run.

Hi Michal,

what kind of controls do you mean?

You can save values as default if you go to the toolbar -> complete -> set values as default.

Edit: If you want to set some controls e.g. switches to true, you need to create a local variable of this control. This variable should be changed into "write" (right click on the variable) and wired to a true constant (boolesch)

4785[/snapback]

Link to comment
Every run of program, I set values on controls (numerical ctrls) - different from run to run.

All I need - when I run program every next time - is that the controls values turn up as they were

the last time of program run.

4786[/snapback]

Do you close this vi completely or do you only stop your vi?

Maybe you can try to create a property node of your control, select value.

Then write this value into a nummeric element. This should remember your value.

Now you can make a case that this element won't change until you run the vi once more.

Link to comment
is there a way how to assign defaults to controls programatically?

I mean, every time I launch the program (subVI in my case) I need the

controls to be set to values used in previous run of the program.

4784[/snapback]

For an example of a VI that does that in a convenient manner see the LuaVIEW toolkit. When you extract the archive, the VI can be found at library/persistence/Libary Persist Position and Controls.vi. The way to use it is to call it with the "load" enum wired to the action input when you start your user interface VI, and call it with the "save" enum wired to the action input when you stop your user interface VI. Give all controls whose value should be persisted a description that starts with the string "(persistent)". No further programming required.

The VI works by locating these controls via VI server and loading/saving their values from/to a file in the default data directory. Note that the position and size of the window is also persisted. Feel free to copy/customise the VI: it uses only a handful of subVIs and is small peripheral part of the toolkit. I have seen variations on the same theme floating around, so you may wish to shop around.

Albert-Jan

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.