DynaPDF Manual - Page 714

Previous Page 713   Index   Next Page 715

Function Reference
Page 714 of 839
SetFieldExpValue
Syntax:
LBOOL pdfSetFieldExpValue(
const PPDF* IPDF,
// Instance pointer
UI32 AField,
// Field handle
SI32 ValIndex,
// Value index or -1
const char* Value,
// New value
const char* ExpValue, // New export value
LBOOL Selected)
// Select the value?
This function can be used to change the choice values of a combo or list box, or to change the state
and export value of check box. In the latter case, the parameter ValIndex will be ignored. If the field
handle refers to a radio button, ValIndex represents the index into the Kids array of the radio button.
To determine how many values are defined in a field call the function GetFieldExpValCount() or
GetFieldEx().
The parameter Value is ignored if the field is a check box or radio button. However, the parameter
ExpValue is required for these field types.
Notice:
If you don't need to change the value or export value then use the function
SetFieldExpValueEx() instead.
If the field is either a combo box or list box, the parameter ExpValue is optional and can be NULL. If
the parameter Value is set to NULL or to an empty string, the choice value will be deleted. Note that
all choice values in a combo or list box must be unique. DynaPDF checks whether another choice
value with the new name does already exist. If this is the case then the function will fail.
Combo boxes which have the field flag ffEdit set accept a value that was directly typed into the field
in a viewer. Such a value may or may not exist the list of choice values. In any case, a special
handling is required for this case because the value must be set as the field's value independent of
whether it is already included in the list of choice value.
To achieve this, set the parameter ValIndex to PDF_MAX_INT (0x7FFFFFFF) or any index greater
than the number of choice values in the field. The parameter Value can also be set to NULL or to an
empty string to delete the field's value. If the string is set then it becomes the new field value but it is
not added to the list of choice values if not included.
Note that the above handling is only valid for combo boxes which have the ffEdit field flag set.
 

Previous topic: SetFieldColor

Next topic: SetFieldExpValueEx