Print Page | Close Window

Weird checkboxes

Printed From: Debenu Quick PDF Library - PDF SDK Community Forum
Category: For Users of the Library
Forum Name: I need help - I can help
Forum Description: Problems and solutions while programming with the Debenu Quick PDF Library and Debenu PDF Viewer SDK
URL: http://www.quickpdf.org/forum/forum_posts.asp?TID=2904
Printed Date: 28 Sep 24 at 10:06PM
Software Version: Web Wiz Forums 11.01 - http://www.webwizforums.com


Topic: Weird checkboxes
Posted By: dsola
Subject: Weird checkboxes
Date Posted: 20 May 14 at 3:37PM
I have problem with checkboxes.
Different versions of Quick PDF differently read theirs properties.

I used same PDF, same code to read same properties with versions 9.11, 9.13, 9.16 and 10.14.
Result are not the same.

Does
anyone know anything about that?


PDF and files are on link:
https://drive.google.com/folderview?id=0B2k-Tu8psXwNUEZyNXFKSUd0Tnc&usp=sharing" rel="nofollow - https://drive.google.com/folderview?id=0B2k-Tu8psXwNUEZyNXFKSUd0Tnc&usp=sharing
Compare txt file to see differences.

 Source Code (Part)
----------------------------------------------------------
var
  ii, nbr : integer;
  checkBoxIsMultiple, lControlExists : Boolean;
  tempFieldID : integer;
  myEnabled : Boolean;
  myInnerValue, myText, myRealName, myCheckBoxValue : string;

BEGIN
 
  myPDF := TQuickPDF.Create;
  myPDF.UnlockKey('xxxxxxxxxxxxxx');

  if myPDF.Unlocked = 0 then
    ShowMessage('Invalid key');

  myPDF.LoadFromFile(xxxxxxxxx, '');
 
  for ii := 1 to myPDF.FormFieldCount do
    if (myPDF.GetFormFieldType(ii) = 4) or (myPDF.GetFormFieldType(ii) = 3) then begin

      myMemo.Lines.Add('==================================================');

      myEnabled       := not (myPDF.GetFormFieldReadOnly(ii) = 1);
      myRealName      := myPDF.GetFormFieldDescription(ii);
      myCheckBoxValue := myPDF.GetFormFieldValue(ii);

      checkBoxIsMultiple := (myPDF.GetFormFieldSubCount(ii) > 2);

      myMemo.Lines.Add('Field ID                : ' + IntToStr(ii) );
      myMemo.Lines.Add('GetFormFieldReadOnly    : ' + BoolToStr(myEnabled,true) );
      myMemo.Lines.Add('GetFormFieldDescription : ' + myRealName );
      myMemo.Lines.Add('GetFormFieldValue       : ' + myCheckBoxValue );

      for nbr := 1 to myPDF.GetFormFieldSubCount(ii) do begin

        myInnerValue := myPDF.GetFormFieldSubName(ii, nbr);
        if (myInnerValue = myCheckBoxValue) then
          myText := 'X'
        else
          myText := '';

        myMemo.Lines.Add('................................');

        myMemo.Lines.Add('     GetFormFieldSubName: ' + myInnerValue + ' - ' + myText );

        if checkBoxIsMultiple then
//          tempFieldID :=  myPDF.GetFormFieldSubTempIndex(ii, nbr)  // ver. 09.xx
          tempFieldID :=  myPDF.GetFormFieldKidTempIndex(ii, nbr)  // ver. 10.11
        else
          tempFieldID := ii;

        myMemo.Lines.Add('     GetFormFieldSubTempIndex : ' + IntToStr(tempFieldID) );
        myMemo.Lines.Add('     GetFormFieldDescription  : ' +  myPDF.GetFormFieldDescription(tempFieldID));
        if not checkBoxIsMultiple then
          myMemo.Lines.Add('     GetFormFieldTitle        : ' +  myPDF.GetFormFieldTitle(tempFieldID));

        myMemo.Lines.Add('     GetFormFieldType         : ' +  IntToStr(myPDF.GetFormFieldType(tempFieldID)));

        lControlExists := (myPDF.GetFormFieldBound(tempFieldID, 1) <> 0);
        myMemo.Lines.Add('     GetFormFieldBound : ' + BoolToStr(lControlExists,true) );

      end;
    end;



-------------
registered QuickPDF user



Replies:
Posted By: AndrewC
Date Posted: 26 May 14 at 6:46AM
dsola,

There have been many changes and improvements with check boxes in 9.x and 10.xx versions.  These change are now complete.  They were changed because of inconsistencies in the functions and SubNames were being used instead of KidNames in various places and it needed cleaning up especially when it came to Radio fields.

If a field is of type Radio then each item is a Kid and you use the Kid functions to access each button.  For each button there are On an Off values and there are the SubNames.  For a Choice field the choices are in the SubNames.

In previous versions the Kids and SubNames were getting mixed up.

I would recommend sticking to one of the more recent versions. 

Andrew.



Print Page | Close Window

Forum Software by Web Wiz Forums® version 11.01 - http://www.webwizforums.com
Copyright ©2001-2014 Web Wiz Ltd. - http://www.webwiz.co.uk