11-25-2010 12:25 PM
Hello.
Let I have two .UIR files and in each of them - 1 panel. "First.UIR" - panel "FIRST", "Second.UIR" - panel "Second".
If I want to load 2 panels simultaneously - i have problems with .H files: #define for some elements equal to each other.
Situation comic: (for instance) requests "SetCtrlVal(FIRST, FIRST_TEXT_FIELD, "333")" = request "SetCtrlVal(SECOND, SECOND_TEXT_FIELD, "333")". I want to change field in panel Second, but all requests works only to first panel.
How check, or unreal?
I know, 1 UIR-file may have many panels; but i don't know, why do possibility to set not one UIR-file in 1 project?..
11-25-2010 04:30 PM
Hi Sergey,
the behaviour you are observing depends on a conceptual mistake in your code: you are using the panel ID as the first parameter in SetCtrlVal (e.g. SetCtrlVal(FIRST, FIRST_TEXT_FIELD, "333"); ) while you should use the panel handle in that field. This is a tricky situation in which code behaviour is completey unpredictable, as the panel ID is most likely to be different fromt the panel handle. To have the code work correctly you must organize it as follows:
handle1 = LoadPanel (0, "first.uir", FIRST);
handle2 = LoadPanel (0, "first.uir", SECOND);
SetCtrlVal (handle1, FIRST_TEXT_FIELD, "333");
SetCtrlVal (handle2, SECOND_TEXT_FIELD, "333");
This framework lies on the concept that each time you load a panel in memory, the system assigns a unique handle to it. All subsequent operations on the panel in memory must be addressed to the object identified by that handle. This permits, in case you need it, to load the same panel more times and have each instance independent from the others as the handles are guaranteed unique by CVI.