Xojo Developer Conference
25/27th April 2018 in Denver.
MBS Xojo Conference
6/7th September 2018 in Munich, Germany.

DynaPDF Manual - Page 635

Previous Page 634   Index   Next Page 636

Function Reference
Page 635 of 750
Return values:
If the function succeeds the return value is 1. If the function fails the return value is 0.
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 botton.
To determine how many values are defined in a field call the function GetFieldExpValCount() or
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.
If you don't need to change the value or export value then use the function SetFieldExpValueEx()
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