Do you own a Debenu Quick PDF Library version 7, 8, 9, 10, 11, 12, 13 or iSEDQuickPDF license? Upgrade to Debenu Quick PDF Library 14 today!
Form fields visible, not accessible |
Post Reply |
Author | |
JohnT
Team Player Joined: 23 Oct 13 Location: United States Status: Offline Points: 30 |
Post Options
Thanks(0)
Posted: 24 Oct 13 at 5:11AM |
I loop through a table and create radio button and checkbox form fields.
The fields appear on the displayed PDF. However, if I programmatically try to access certain fields either by title or index, they are not available. Even checking with the following Delphi diagnostic loop reveals that certain fields are not there. TotalFormFields := DPL.FormFieldCount(); for i := 1 to TotalFormFields do Begin FieldValue := DPL.GetFormFieldValue(i); FormFieldTitle := DPL.GetFormFieldTitle(i); Showmessage(inttostr(i) + ' ' + FormFieldTitle + ' ' + FieldValue); end; And of course DPL.SetFormFieldValueByTitle and DPL.SetFormFieldValue do not work since the fields seemingly disapear. The confusing part is that the fields are visually available and their titles display. Thanks for any hints. Hope this gives at least enough to point me in the right direction. John
|
|
JohnT
Team Player Joined: 23 Oct 13 Location: United States Status: Offline Points: 30 |
Post Options
Thanks(0)
|
Update...
As expected it appears to be my problem. When creating simple checkboxes for all fields everything is fine. I have some sort of problem when creating subfields for radiobuttons. The subfields are visible and a call to: DPL.DrawText(500,Vertical, DPL.GetFormFieldTitle(r1)); shows the expected result. More later when I find the cause. Sorry for the "static." John
|
|
AndrewC
Moderator Group Joined: 08 Dec 10 Location: Geelong, Aust Status: Offline Points: 841 |
Post Options
Thanks(0)
|
John,
Here is some sample code that you might find useful Andrew. |
|
JohnT
Team Player Joined: 23 Oct 13 Location: United States Status: Offline Points: 30 |
Post Options
Thanks(0)
|
Thanks Andrew.
Unfortunately, I am still having a problem. Hopefully a brief read of this Delphi excerpt by a set of fresh eyes will tell me what I am doing wrong. I loop through a table and make a decision whether a field should be a radio button, (mutually exclusive) or simply a checkbox. The checkboxes work fine. Only the first radio button can actually have its value set. All subsequent attempts to set a value fail. The raw code with the diagnostics included are shown. I test to see if the value can be set on the radiobutton field. It is successful if it happens to be the FIRST radiobutton in a group. After that it will not set the value. Thanks for any insight anyone might have. Sincerely, John if OptionsBookMasterQuery.FieldByName('MutuallyExclusive').value = True then begin r2 := DPL.NewFormField(OptionsBookMasterQuerySelectionName.value, 4); MarkNone := True; ///variable used to decide if a "None" radiobutton will be shown/value set Showmessage('Created: ' + inttostr(r2)); ///diagnostic confirms the index number is there end; ... while not Form1.OptionsBookQuery.eof do Begin ProspectusPriceListCheckQuery.close; ProspectusPriceListCheckQuery.Params[0].Value := Form1.CustomerLocalcustnmr.value; ProspectusPriceListCheckQuery.Params[1].Value := Form1.OptionsBookQueryRecord.value; ProspectusPriceListCheckQuery.Open; if ((OptionsBookMasterQuery.FieldByName('MutuallyExclusive').value <> True) or (OptionsBookQuery.RecordCount = 1)) then begin /// checkboxes work fine...problem down below with radio buttons r0 := DPL.NewFormField(Trim(FloatToStr(OptionsBookQueryRecord.value)), 3); ///checkbox DPL.SetFormFieldBounds(r0, 50, Vertical - 15, 20, 20); DPL.SetFormFieldCheckStyle(r0, csCheck, 1); DPL.SetFormFieldBorderColor(r0,0,0,0); end;// else if OptionsBookMasterQuery.FieldByName('MutuallyExclusive').value = True then begin Showmessage('Field: ' +OptionsBookQueryName.value + ' ' + Trim(FloatToStr(OptionsBookQueryRecord.value)) + ' '+ inttostr(r2)); r1 := DPL.AddFormFieldSub(r2, Trim(FloatToStr(OptionsBookQueryRecord.value))); Showmessage('SubField: ' +OptionsBookQueryName.value + ' ' + Trim(FloatToStr(OptionsBookQueryRecord.value)) + ' '+ inttostr(r1)); DPL.SetFormFieldBounds(r1, 50, Vertical - 15, 20, 20); DPL.SetFormFieldCheckStyle(r1, csCheck, 1); DPL.SetFormFieldBorderColor(r1,0,0,0); If ProspectusPriceListCheckQuery.recordcount = 1 then begin c1 := 0; c1 := DPL.SetFormFieldValue(r1,'Yes'); if c1 <> 0 then showmessage('SUCCESS'); c2 := 0; c2 := DPL.SetFormFieldValueByTitle(Trim(FloatToStr(ProspectusPriceListCheckQuery.fieldbyname('PriceListRecordNumber').value)),'Yes');// if c2 <> 0 then showmessage('SUCCESS 2'); Showmessage('R1 ' + DPL.GetFormFieldValue(R1)); MarkNone := False; end; end; |
|
JohnT
Team Player Joined: 23 Oct 13 Location: United States Status: Offline Points: 30 |
Post Options
Thanks(0)
|
PROBLEM SOLVED!
I misunderstood how the SetFormFieldValue function works. Thanks for "listening." John
|
|
Post Reply | |
Tweet
|
Forum Jump | Forum Permissions You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |
Copyright © 2017 Debenu. Debenu Quick PDF Library is a PDF SDK. All rights reserved. About — Contact — Blog — Support — Online Store