Mark Yedinak Posted June 25, 2008 Report Share Posted June 25, 2008 Can anyone explain how I can set the default value for a X-control. I created a X-control for connection configuration data (serial, parallel port, TCP/IP and USB) and for the life of me I can't seem to define default values for the data. The serial port configuration is the most complex and is comprised of multiple typedefed enums (for BAUD rate, parity, stop bits, etc.) and no matter what I have tried I can't get the default values I want. They always revert to the first value in the enum list. I have tried setting the default value for the typedefs, the individual controls, the controls on the facade and the internal data structures (like I said, I have tried everything). Nothing seems to work. Any suggestions would be appreciated. Quote Link to comment
Matt W Posted June 25, 2008 Report Share Posted June 25, 2008 I believe the defaults can be set in the XControl's Init ability. Matt W Quote Link to comment
Ton Plomp Posted June 25, 2008 Report Share Posted June 25, 2008 XControl storage comes in two parts, saving and retrieving: Saving is done with the XControl:Abilities:Convert_state_for_save_Ability_VI. Retrieving is done with the XControl:Abilities:Init_Ability_VI. To trigger the convert state for save ability you should save the owning VI, this VI has a variant container for the data of the XControl. In the Init ability you can read back this variant. Inside your State ability you could have two sets of data, Current with the settings currently used, and Default with the default parameters, inside your XControl you could write code that copies Current to Default and in the convert state for save ability you only store the Default parameters. Ton Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.