fanzhenjun 发表于 2010-7-15 21:19:44

退出cvi时,如何将程序中的输入控件当前数值保存为默认值

退出cvi时,如何将程序中的输入控件当前数值保存为默认值???困扰中

cpubbs 发表于 2010-7-15 23:48:23

一是可以读写文件。另一种是在labwindows/cvi中有一个函数,能保存当前界面的所有控件的值的!具体一下忘了名字!还可以载入的!

cpubbs 发表于 2010-7-15 23:48:45

Saves the current values of all controls on a panel.

This function also saves the following control attributes:

Label/value pairs of the list-type controls, and their indices
Minimum, maximum, and increment values for numerics
List box checkmark state values
If you want to retain the data for plots in a graph control, your original array must still be in memory when you call RecallPanelState. Alternatively, you can configure the graph to make a copy of your plot data. You can do this in the User Interface Editor or by calling SetCtrlAttribute with the ATTR_COPY_ORIGINAL_DATA attribute.



Prototype

int SavePanelState (int Panel_Handle, char Filename[], int State_Index);

cpubbs 发表于 2010-7-15 23:49:04

上面是保存的,下面是读取的!

Reads a panel state from a file you previously created with SavePanelState. If the panel is currently visible, all controls are updated to reflect their new states.

Note   If you have modified the panel in the User Interface Editor or programmatically since you saved the panel state, recalling the panel state can fail or erroneously change the current state of the panel.

If one of the controls in the panel is an ActiveX control, any CAObjHandle that you had previously obtained for that control is no longer valid. After calling this function, you must use GetObjHandleFromActiveXCtrl to obtain a new handle.


Prototype

int RecallPanelState (int Panel_Handle, char Filename[], int State_Index);

wangchao685 发表于 2010-7-16 11:38:39

回复 1# fanzhenjun 的帖子


    右击输入控件——数据操作——当前值设置为默认值,然后将VI保存,下次再打开的时候就是默认值了

cvifan 发表于 2010-7-20 10:07:15

回复fanzhenjun 的帖子


    右击输入控件——数据操作——当前值设置为默认值,然后将VI保存,下次再 ...
wangchao685 发表于 2010-7-16 11:38 http://www.cpubbs.com/bbs/static/image/common/back.gif


哥们搞错了。CVI中没有这个。你说的VI是LABVIEW

wangchao685 发表于 2010-7-20 10:39:36

回复 cvifan 的帖子


    不好意思啊

fanzhenjun 发表于 2010-8-2 12:56:00

回复 wangchao685 的帖子


    谢谢老兄,我没看懂,能详细点吗?用二楼的可以实现.

lvhu1987 发表于 2016-6-20 18:41:55

请问问题解决了没有

cvifan 发表于 2016-6-21 08:53:32

lvhu1987 发表于 2016-6-20 18:41
请问问题解决了没有

3,4楼不是有答案么哥们

Aryiaa 发表于 2017-9-29 18:44:56

这个问题解决了没,savepanelstate这个函数我怎么不会用啊

Aryiaa 发表于 2017-9-29 18:48:35

cpubbs 发表于 2010-7-15 23:48
一是可以读写文件。另一种是在labwindows/cvi中有一个函数,能保存当前界面的所有控件的值的!具体一下忘了 ...

求指教

cvifan 发表于 2017-9-30 08:49:25

int SavePanelState (int Panel_Handle, char Filename[], int State_Index);
第一个是面板的handle这个你肯定有了,第二个是路径,第三个是索引号,保存的这状态的索引,你定义一个变量存一个值,到时候要重新载入的时候,也要输入相同的值!
页: [1]
查看完整版本: 退出cvi时,如何将程序中的输入控件当前数值保存为默认值