Using the GetOpt function of the IPXC_FormField interface has enabled me to read entries in the drop down list of values. However I can't seem to set the text value of the combo box. I've tried to select an item from the list, I've tried using the SetValueText function, I've tried accessing the Edit property of the IUIX_Combo after typecasting the IPXC_FormField as an IUIX_Combo, but it's always nil.
Below is the code I've used so far, that works with other types of fields:
Code: Select all
var
i: Integer;
b: WordBool;
PFormField: IPXC_FormField;
iCombo: IUIX_Combo;
iEdit: IUIX_Edit;
s,s2: WideString;
begin
// Set field values
for i := 0 to Pred(FPDFEdit.Doc.CoreDoc.AcroForm.FieldsCount) do
begin
PFormField := FPDFEdit.Doc.CoreDoc.AcroForm.Field[i];
case PFormField.type_ of
FFT_RadioButton: PFormField.CheckWidget(1,True);
FFT_CheckBox: PFormField.CheckWidget(0,True);
FFT_ComboBox: begin
iCombo := IUIX_Combo(PFormField); // this has an instance pointer but a nil Edit interface (IUIX_OBJECT)
iCombo.Edit.QueryInterface(IID_IUIX_Edit,iEdit); // this doesn't work
PFormField.GetOpt(1,s,s2,b); // := 'MyOhMy'; // this works
iEdit.SetText(PChar(s),Length(s)); // iEdit is null
// PFormField.SetValueText(s); // this doesn't work
Thanks.