09-19-2008 10:57 AM
09-19-2008 04:36 PM
If your panels are kept in separate UIRs, then you can just conditionally include the corresponding .h file and conditionally specify the .uir filename in LoadPanel:
#define EQUIPMENT_1
#ifdef EQUIPMENT_1
#include "Equipment1UI.h"
#define UIR_FILENAME "Equipment1UI.uir"
#elif defined(EQUIPMENT_2)
#include "Equipment2UI.h"
#define UIR_FILENAME "Equipment2UI.uir"
...
#endif
int main (int argc, char *argv[])
{
...
panelHandle = LoadPanel (0, UIRFILENAME, PANEL));
...
}
This works well if your control constants (e.g. PANEL_BUTTON1, PANEL_GRAPH, ...) and callback functions are named consistently from one UIR to the next.
Another approach would be to put all your UI variations in one UIR file. Then your panel constants would have to be different, and therefore, so would all of your control constants. That makes things a little more tricky, because you have to pass a different constant into UI library functions depending on which piece of equipment you're building for. You can work around this issue pretty easily by doing something like this:
#ifdef EQUIPMENT_1
#define THE_PANEL PANEL
#define CTRL(NAME) PANEL2##_##NAME
#endif
Then just use THE_PANEL wherever you need the panel constant, and use CTRL(BUTTON), for example, wherever you would have used PANEL_BUTTON or PANEL2_BUTTON.
Hopefully this gives you some ideas. If I'm way off in understanding your original question, please let me know.
Mert A.
National Instruments
09-22-2008 04:43 AM
Thanks for those suggestions, I hadn't realised that there were so many ways of killing a cat! My tired brain was working over the weekend and came up with the idea of providing the basic set of controls on the standard panel, then conditionally including code to programmatically add the extra controls and reposition the standard ones where required using the control attributes. Which is the easiest to manage, in your experience?
When using separate uir's, do you just make a copy of the first one and keep it in the workspace under a new name? Presumably if you start working on the second one, it generates a new .h include file when you save changes?
09-22-2008 02:12 PM
If your panels are really *slightly* different, you could create one panel only in the UIR editor with all controls needed for all types of devices, programmatically customizing its aspect dependng on the type of equipment tested. This permits you to have one set only of controls in your program.
You can programmatically apply all properties that you can set in the UIR editor, so you can:
09-23-2008 05:01 AM
That sounds exactly what I want to do. Many thanks. I was worried about maintaing different panels and include files.