LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Compare two panelstates of the same panel saved with "savepanelstate()"

Hello,
 
i'm looking for a chance to compare a panel with a older state of it. Ther are a lot of Strings, Check-Marks and so on at the panel.
The user can change everything.
 
When the User click OK i want to check if something is changed at the panel. The routines to check and validate all the checkmarks and so
is running, but i want to know if something is changed before i start my routine for check every position is in range or so.
 
I found the routines
 
savepanelstate() and recallpanelstate()
 
but not something like comparepanelstate()
 
 
My Idea is, to build checksums of the savepanelstate() file and compare it?
 
Anyone an idea?
 
 
Thanks
 
Mile
 
0 Kudos
Message 1 of 4
(3,306 Views)
Mile,

there is no direct way to solve the issue you are having with CVI here. And i doubt that your idea with SavePanelState() works out fine for you since the command was created for the purpose to save the current values of the controls. It does not give you any idea of the position/size and order from the controls, only from the values stored in them (ok, perharps order, since the values has to be stored in some order...).
The simpliest thing i can think about is to convert the UIR to a sourcefile. You will get a c-file, which creates the user interfact dynamically. If you changed something on the UIR, convert it again and use the Diff-Tool (in the Edit-menu) to differ the two sourcefiles.
The drawback of this method is that you always have to create a new c-file manually from the UIR just to check for differences.......

Norbert B.
Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
0 Kudos
Message 2 of 4
(3,279 Views)

It seems to me that Mile is trying to do this at runtime, not at design time.

The usual way I use to detect if the user has changed some value on a panel is to add to the panel a hidden checkbox and turn it on every time the values in the controls are changed. Next, the first thing to look at when the user clicks OK button is this checkbox value: if 1 it means some value has changed.

To simplify this procedure, I have created one callback linked to all controls that simply traps EVENT_VAL_CHANGED and sets checkbox value to 1. This callback can be chained to existing controls callbacks, if any.

To make this procedure general-use, I use the callbackData parameter of each control to store checkbox ID and in the callback I simply SetCtrlVal (panel, (int)callbackData, 1); to turn the checkbox on. Since callbackData parameter cannot be assigned at design time, I use a series of SetCtrlAttribute (,,,,,, ATTR_CALLBACK_DATA, (void *)checkBoxID); when I load the panel. An even simpler method could be to create a list of control IDs and to create a SetCallbackDataForList function as a customized copy of SetAttributeForList function.

Just my 2c...



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 3 of 4
(3,273 Views)
Thanks a lot, the idea with the hidden control works fine.
 
 
0 Kudos
Message 4 of 4
(3,223 Views)