LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Save dynamically created UIR

Hello

I am working on an application called Aniamtion. In this application i am creating the objects (like LED, Numeric, Static and Rectangle ) dynamatically. In next step i want to provide the "Save' and "Save As" option. With this it should be possible to save the dynamatically created objects. Also should be possible to reload it. It will be something like saving the .uir file at Runtime (within user application) and open it with in same user application.

Many Thanks
Rakesh
0 Kudos
Message 1 of 7
(3,968 Views)
I can basically think of two methods to do this:

1. When creating each control, save its settings in a file; the "Save UIR" button will then be only a way of assigning a name to this file and storing it elsewere on disk

2. When the user presses "Save" button, run through all controls in the UIR with a loop from 1 to ATTR_NUM_CTRLS panel attributes, for each of them save the appropriate attributes on switching on ATTR_CONTROL_STYLE attribute to determine which attribute to save

In both cases, reloading the UIR means only to elaborate this file and recreate the controls step-by-step.

You must decide the format of the output file, for example a INI file with the structure copied from the TUI files generated by the UI to code converter.

[Panel001]
ATTR_DIMMED = False
ATTR_CONSTANT_NAME = "avvio"
ATTR_CALLBACK_NAME = ""
ATTR_VISIBLE = True
ATTR_LEFT = 820
ATTR_TOP = 21

[Panel001_Control001]
ATTR_DIMMED = False
ATTR_CONSTANT_NAME = "pgm"
ATTR_CALLBACK_NAME = ""
ATTR_VISIBLE = True
ATTR_LEFT = 250
ATTR_TOP = 98

and so on...

Not exactly a brilliant coding, I'm afraid: a lot of cumbersome and boring work... but it should work...


Otherwise ask BilaD if he can distribute the code for the UI to code converter to you 😄


Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 2 of 7
(3,958 Views)

Sorry to bring an old post back from the dead, but did BilaD or anyone else ever distribute the code for the 'UI to code converter'?

0 Kudos
Message 3 of 7
(3,633 Views)

For newer version of CVI the converter is installed in the Tools folder: Programs / National Instruments / CVI / Tools. For convenience, it has its own entry in the Start menu Smiley Happy

0 Kudos
Message 4 of 7
(3,631 Views)

Has anyone ever gone the other direction, that is to save a UIR from a dynamically created user interface or to convert a tui back to a uir?

0 Kudos
Message 5 of 7
(3,624 Views)

Thanks Wolfgang!

0 Kudos
Message 6 of 7
(3,616 Views)

Hi mvr,

 

I don't have a good solution for how to save a dynamically created user interface back to a .uir. But if you're interested in converting a .tui into a .uir, then the CVI automation interface has a function that should do just that. Search in the CVI help for ConvertTUIToUIR.

 

Luis

0 Kudos
Message 7 of 7
(3,588 Views)