06-13-2018 03:08 PM
Is there some way to dynamically retrieve all panels that are in an application or at least all the panels per .uir?
Thanks
Solved! Go to Solution.
06-14-2018 02:21 AM - edited 06-14-2018 02:22 AM
You can retrieve all panels that are in a .UIR file with a simple trick. If you look into the include file associated to an .UIR file you will see that panels are listed inside it. Pnale constant names are in effect macros that evaluates on progressive numbers inside the include file, starting from 1 on. That is, when you call LoadPanel (..., "myUIR.UIR", PANEL); you are really telling CVI to load panel #x from the .UIR file, where x is the value PANEL macro evaluates to.
Given this, loading all panels in a .UIR can be done with a simple loop like this one that prints the constant name of all panels in a file:
index = 0; while (TRUE) { handle = LoadPanel (0, "myfile.uir", ++index); if (UIEInvalidIDinResourceFile == handle) break; // End of panels if (handle < 0) { // Error checking break; } GetPanelAttribute (handle, ATTR_CONSTANT_NAME, msg); DebugPrintf ("Panel %d: %s\n", index, msg); DiscardPanel (handle); }
You could also experiment with ATTR_NEX_PANEL panel attribute, but that one is aimed to enumerating child panels and in my attempts it not correctly working with top level panels (even though the help says it should).
06-21-2018 12:41 PM
Worked like a champ. Your the man. Thanks