Jump to content

X-Controls and default values


Recommended Posts

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.

Link to comment

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

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.