11-15-2005 11:32 AM
11-15-2005 12:44 PM
Hi, to read a value from a control you need GetCtrlVal (panel, control, &val). SetCtrlVal permits you to assign a value to the control.
The default values is used only when you load a panel or when you revert the control to default by using DefaultCtrl or DefaultPanel. In case you want to help the operator in setting up a test, you may want to use two additional attributes per each control: ATTR_MAX_VALUE and ATTR_MIN_VALUE besides the default value. In any case, don't forget to apply defaults after you have set all controls' attributes.
As per reading / writing this value to a file, every C manual will help you in the use of fprintf () and fscanf () which are what you need. More detailed functions can be used for this task, among which the IniFile instrument which permits you to save to disk data in an organized fashion imitating the structures of .INI files in windows: it's to you the choice if using some simple, raw and easy instructions or deeping into more complicated tools.
11-15-2005 01:16 PM
11-15-2005 03:14 PM
11-15-2005 04:13 PM
If you use the User Interface Library functions SavePanelState() (when your program exits) and RecallPanelState() (when it is restarted), you can restore all controls on any panel to their previous values. I find this an easy way to preserve software configuration and status between runs. It is possible to store multiple sets of control values using only one file per panel.
This will work provided that the .uir file is not modified between runs (can cause RecallPanelState() to fail).
Colin.
11-17-2005 05:51 AM
11-17-2005 08:11 AM
Do these functions (Save/Recall Panel State) modify the .uir file itself, or use a different file to store the information? If the .exe is built with the .uir file embedded inside it (my preferred method) then I don't see how it could write to the .uir component.
JR
11-17-2005 09:33 AM
11-17-2005 09:33 AM
11-17-2005 09:44 AM
The functions (Save/Recall Panel State) do not modify the .uir file itself, they use a different file to store the information.
The format is "int RecallPanelState (int panelHandle, char filename[], int stateIndex);"
Where:
1) panelHandle is the panel handle for the original Panel (GUI)
2) filename is the path to and name of the file, "path // filename.extension",
3)stateindex Is an intiger pointer to a given Panel (GU) versionI in the file "filename". you can save many different versions of a gui and load them from filename with the index number.
in my application I am saving to a file named "oldPnlState" in the root of drive C: and I want the first panel (GUI) saved in this file. Hence I wrote "SavePanelState(dustPanel, "C://oldPnlState.uir", 1);" There is no functional significance to the extension uir.