LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Should I use seperate UIR files for each Panel?

I'm doing my first CVI project and have a question...
 
What are the advantages/disadvantages of using a seperate UIR file for each panel?
 
My program will have 3 or 4 large panels (1 user interface plus several setup screens) with several smaller panels like password entry screens etc
I am primarily using global variables and arrays for data passing and some panels have to access all of these globals.
 
What is generally considered "standard CVI practice"? A seperate UIR for each and every panel, or just throw them all onto the one UIR if it's a small enough project?
 
Any traps to watch out for?
 
From my initial playing it seems to be slightly more awkward from a programming point of view to use seperate UIR files, as each one has it's own C file. But I like the visual neatness of the seperate files, with each one in it's own window.
Then again, it's nice to have everything in the one file...
 
Comments?
 
Thanks
Dave 🙂
0 Kudos
Message 1 of 3
(3,341 Views)

Hi, Dave.

There is no real reason to make a separate UIR file for each panel, since the UIR editor accepts several panel into one single UIR file (I arrived at approx. 30 panel into one UIR, I don't know if there's a real limit on this...).

Said this, several words can be spent on "style", and I don't expect my way of programming to be an absolute  reference Smiley Happy so I'll tell you what are my habits and maybe some others will do...

 

I work on relatively small projects, that use 10 to 15 panels. I organize the project in one UIR file and 2 (sometimes 3) source files. The primary source file includes the Main and all functions related to user interface, while other source files holds all general functions and in general all source code not directly related to user interface. In case reports are made by printing panels, a second UIR holds report templates.

I'm not really interested in having several source files since navigation inside the functions is quite easy knowing some keyboard shortcuts. When I work on a project, I always open source file in a regular order: first the source with the Main, then the others, so it's easy to go to one or the others using Ctrl-x shortcut. Ctrl-I when the cursor is on a function name moves you to its code, Ctrl-F moves you to a UIR object, right-click on a UIR object moves you to its callback...

 

Costs and benefits analisys:

By having few UIR files the number of project files reduces and it's easy to have project structure in mind.

On the contrary, if you must update a single panel of the applications, you must update the whole UIR file. Since I use to change file name when moving from one version to the next (filenames holds a progressive number for this reason) I use to put UIR filenames in macros and use them instead of the filenames inside the project, so while updating the project I'm not compelled to update every single LoadPanel. As an example:

#define UIR      "myproject_xx.UIR"

#include "myproject_xx.h"

And inside the code I use

panelHandle = LoadPanel (0, UIR, "mypanel");



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?
Message 2 of 3
(3,329 Views)
Thanks for that.
I think I might try the single UIR approach first and see how it goes.
The way I'm reading the CVI documentation it sort of implies that the single UIR is the normal way to go, but it can support multiple UIR's if required (for very large or very modular projects I guess)
 
Thanks
Dave 🙂
0 Kudos
Message 3 of 3
(3,306 Views)