A5.ViewBoxsetValue Method
Syntax
A5.ViewBox.setValue(value[,executeSelect])
A5.ViewBox.setValue(id[,executeSelect])
A5.ViewBox.setValue(customSelection[,executeSelect])
Arguments
- valueany
The value(s) to use in the view box. Pass in an array for values for multiple selections.
- idstring
The ID of the item in the view box from which to get the value of the view box. Must be prefixed with a "#", for example "#firstname".
- customSelectionobject
Custom selection settings.
- selectstring
The type of custom selection to do. Values are "all", "add", "remove", "toggle" and "match". The "all" custom selection will select all values in the view box. The "add, "remove" and "toggle" custom selections will perform those actions with the passed in value(s). The"match" custom selection will use a passed in function to match values to select.
- valueany
The value(s) to use in for "add", "remove" or "toggle". Pass in an array of values for multiple selections.
- matchfunction(value)
The function to use to match value(s) to be selected. This will be called for each value, and the function should return true or false to indicate if the value should be selected or not.
- valueany
The value to select.
- executeSelectboolean
Whether or not to execute the select events. The change event will always be executed when the value changes.
Description
Set the value in the view box.
Example
// To get a pointer to the A5.ViewBox class see {dialog.object}.getControl // assume vbObj is a pointer to an instance of the A5.ViewBox class vbObj.setValue('a',true); // set the value of the view box to "a" and fire the select events vbObj.setValue('#item1',false); // set the value of the view box to the value of the element with the ID "item1" and don't fire the select event vbObj.setValue({select: 'all'}); // select all vbObj.setValue({select: 'add', value: ['a','b']}); // add the values "a" and "b" to the current selection vbObj.setValue({select: 'match', match: function(v){ if(v[0].toLowerCase() == 'alpha') return true; return false; }}); // select values that start with "alpha"