LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How can I reset Xcontrols back to defaults?

I have an application that has four instances of an xcontrol on the front panel. Each instance has different default values as saved in the toplevel VI.

 

The default values are present if I load the toplevel VI from memory, but I have not found a way to later do a global "reinitialize values to defaults" or do a "right-click...data operations...reinitialize to defaults" on any one of them. If I do this, nothing happens, they stay at whatever values they currenty have.

 

This problem can easily be demonstrated with the example "Run Dual Mode Thermometer xcontrol.vi" from the example finder: Change the value of the xcontrol (run mode or edit mode) and try to reset it back to defaults as described, nothing happens.

 

Is there any way to get this to work?

 

(Currently, I am writing the default values via local variables as needed but I would prefer if they would behave more similar to normal controls in this respect).

Message 1 of 11
(4,663 Views)

Hopefully Ton will reply latter but...

 

I thought I had to explicitly write all of the methods and properies myself, so if you did not write an "init to default" method...

 

I'll check back latter to learn something.

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 2 of 11
(4,632 Views)

What default value do you exactly mean?

The Data State value OR the Internal State value?

 

I think the data value will be reset by the owning VI while the State data is in control by the XControl.

 

Tomorrow night I can do more testing.

 

Otherwise you will have to build your own context menu with option.

Maybe you can capture the event in the facade VI?

 

Ton

Free Code Capture Tool! Version 2.1.3 with comments, web-upload, back-save and snippets!
Nederlandse LabVIEW user groep www.lvug.nl
My LabVIEW Ideas

LabVIEW, programming like it should be!
Message 3 of 11
(4,629 Views)

TonP wrote:

The Data State value OR the Internal State value?


I want to reset each instance to the values it had when I first opened the VI.

 

I did a few more tests, and it seems the problem is that the facade does not get updated, while the internal value actually changes back to the defaults.

 

The wire value is actually back to defaults (!!!), but an xcontrol indicator connected to that wire does not reflect the correct wire value until it gets "wiggled". This does not sound right!

.

 I made an example that shows the weird behavior (LabVIEW 8.5.1).

 

The attached VI contains 3 temperature xcontrols (from the labview example)..

  1. default = ~20C
  2. default = ~50F
  3. default - ~80C

The FP contains instructions to reproduce the problem. (Of course all 6 instances of the xcontrol have the problem, not just #3).

 

(The xcontrol is located at: C:\Program Files\National Instruments\LabVIEW 8.5\examples\general\xcontrols\Dual Mode Thermometer )

Message Edited by altenbach on 01-14-2009 09:13 AM
Message 4 of 11
(4,607 Views)

Hi All,

This was reported to R&D (# 44114) for further investigation. A possible workaround is to create a button that will just reset the XControl back to the default value using a property node instead of right-clicking on the control. The invoke node of Reint to Default will not work.

Joshua B.
National Instruments
Message 5 of 11
(4,590 Views)

Joshua B. wrote:

A possible workaround is to create a button that will just reset the XControl back to the default value using a property node instead of right-clicking on the control. The invoke node of Reint to Default will not work.


Thanks! Do you mean writing a value property?

 

From what I can tell, "reinit to defaults" and "default vals.Reinit all" both don't work.

 

Message Edited by altenbach on 01-14-2009 10:16 AM
Message Edited by altenbach on 01-14-2009 10:18 AM
Message 6 of 11
(4,582 Views)
You can get the right-click->Data Operations->Reinit to Default to work.  If you create an event for Shortcut Menu Selection (App) event for the control (in the example, Scale and Temperature) and the Item Tag will be APP_SC_REINIT_TO_DEFAULT_VALUE.  Just rewire the data wire to the indicator/control.
0 Kudos
Message 7 of 11
(4,574 Views)
I dropped in a message box to the fascade VI, and the the fascade VI doesn't even run when you select reinit from the menu.  I don't believe you have anyway currently to get it to work from the Menu.  As Ben mentioned, you can write your own Method for reinit to default that you can at least use in the program.
Message 8 of 11
(4,565 Views)

Matthew Kelton wrote:
I dropped in a message box to the fascade VI, and the the fascade VI doesn't even run when you select reinit from the menu.  I don't believe you have anyway currently to get it to work from the Menu.  As Ben mentioned, you can write your own Method for reinit to default that you can at least use in the program.

And Matthew wrote:


You can get the right-click->Data Operations->Reinit to Default to work.  If you create an event for Shortcut Menu Selection (App) event for the control (in the example, Scale and Temperature) and the Item Tag will be APP_SC_REINIT_TO_DEFAULT_VALUE.  Just rewire the data wire to the indicator/control.

 Does that mean the APP_SC_REINIT_TO_DEFAULT_VALUE didnt trigger the facade VI?

What if you registered for the owning VI in the facade VI?

 

Ton

Free Code Capture Tool! Version 2.1.3 with comments, web-upload, back-save and snippets!
Nederlandse LabVIEW user groep www.lvug.nl
My LabVIEW Ideas

LabVIEW, programming like it should be!
0 Kudos
Message 9 of 11
(4,544 Views)
The fascade runs when you use the right-click context menu and you can capture the event using APP_SC_REINIT_TO_DEFAULT_VALUE.  When you use the File menu to reinitialize defualt values, the fascade VI never runs.  I imagine the Data.ctl associated with the XControl gets its value changed, but the Data Change Event never fires.  I looked at just using the Timeout event to handle the data change, but the File Menu doesn't cause the fascade to run (I had tried using VI Menu Selection (App) as an event with no luck).  When I dropped a message box in the timeout event case, it doesn't display when you use the File Menu.
Message 10 of 11
(4,534 Views)