Components for Developers
© 2000-2012, Two Pilots

PDF Library Download Features Manual Tutorials FAQ Pricing HTML2PDF-X Pilot History In the Lab

PDF Creator Pilot documentation

Download CHM version of this manual.
Actions
CreateVisibleControlAction

See Also Example
Collapse All

Creates actions for showing or hiding controls.

Syntax

LONG CreateVisibleControlAction (
VARIANT_BOOL visible
)
Parameters
visible
Specifies whether to show (VARIANT_TRUE) or hide (VARIANT_FALSE) a control

Return value
Index of the created action.

Remarks

CreateVisibleControlAction allows users to hide or show one or more PDF controls on the screen by setting or clearing the hidden flags. Use AddControlToAction method to associate controls with this action.

The return value is an action identifier in the document's actions collection and can be used in AddControlToAction, OpenDocumentAction, PDFANNOTATION_OnBeforeFormatting, PDFANNOTATION_OnChange, PDFANNOTATION_OnKeyPress, PDFANNOTATION_OnSetFocus, PDFANNOTATION_OnLostFocus, PDFANNOTATION_OnMouseDown, PDFANNOTATION_OnMouseUp, PDFANNOTATION_OnMouseEnter, PDFANNOTATION_OnMouseExit, PDFANNOTATION_OnOtherControlChanged, PDFPAGE_SetAction, PDFANNOTATION_Action, PDFOUTLINENODE_Action.

Equivalent in new interface: IPDFDocument4::CreateHideControlAction, IPDFDocument4::CreateShowControlAction.

Example

AddControlToAction Example

Delphi
[copy to clipboard]
{ PDF object is supposed to be created }
PDF.BeginDoc;

e1 := PDF.PDFPAGE_CreateControl_Edit('field1', 20, 20, 120, 32);
PDF.PDFANNOTATION_Text := 'Some text';

e2 := PDF.PDFPAGE_CreateControl_Edit('field2', 140, 20, 240, 32);
PDF.PDFANNOTATION_Text := 'Other text';

c1 := PDF.PDFPAGE_CreateControl_Checkbox('check1', 250, 20, 262, 32);

b1 := PDF.PDFPAGE_CreateControl_Button('but1', 180, 60, 240, 80);
PDF.PDFANNOTATION_Caption := 'Submit';
PDF.PDFANNOTATION_OnMouseUp := PDF.CreateSubmitFormAction('http://127.0.0.1', true, stGet);

b2 := PDF.PDFPAGE_CreateControl_Button('but2', 260, 60, 320, 80);
PDF.PDFANNOTATION_Caption := 'Hide some...';

a_hide := PDF.CreateVisibleControlAction(false);
a_show := PDF.CreateVisibleControlAction(true);

{ Now add needed controls to be hidden/shown on button pressed/released }
PDF.AddControlToAction(a_hide, e1);
PDF.AddControlToAction(a_hide, c1);
PDF.AddControlToAction(a_hide, b1);
PDF.AddControlToAction(a_show, e1);
PDF.AddControlToAction(a_show, c1);
PDF.AddControlToAction(a_show, b1);

PDF.PDFANNOTATION_OnMouseDown := a_hide;
PDF.PDFANNOTATION_OnMouseUp := a_show;

PDF.EndDoc;
C/C++
[copy to clipboard]
// PDF object is supposed to be created
PDF->BeginDoc();

LONG e1 = PDF->PDFPAGE_CreateControl_Edit("field1", 20, 20, 120, 32);
PDF->PDFANNOTATION_Text = "Some text";

LONG e2 = PDF->PDFPAGE_CreateControl_Edit("field2", 140, 20, 240, 32);
PDF->PDFANNOTATION_Text = "Other text";

LONG c1 = PDF->PDFPAGE_CreateControl_Checkbox("check1", 250, 20, 262, 32);

LONG b1 = PDF->PDFPAGE_CreateControl_Button("but1", 180, 60, 240, 80);
PDF->PDFANNOTATION_Caption = "Submit";
PDF->PDFANNOTATION_OnMouseUp = PDF->CreateSubmitFormAction("http://127.0.0.1", TRUE, stGet);

LONG b2 = PDF->PDFPAGE_CreateControl_Button("but2", 260, 60, 320, 80);
PDF->PDFANNOTATION_Caption = "Hide some...";

LONG a_hide = PDF->CreateVisibleControlAction(FALSE);
LONG a_show = PDF->CreateVisibleControlAction(TRUE);

// Now add needed controls to be hidden/shown on button pressed/released
PDF->AddControlToAction(a_hide, e1);
PDF->AddControlToAction(a_hide, c1);
PDF->AddControlToAction(a_hide, b1);
PDF->AddControlToAction(a_show, e1);
PDF->AddControlToAction(a_show, c1);
PDF->AddControlToAction(a_show, b1);

PDF->PDFANNOTATION_OnMouseDown = a_hide;
PDF->PDFANNOTATION_OnMouseUp = a_show;

PDF->EndDoc();
C#
[copy to clipboard]
// PDF object is supposed to be created
PDF.BeginDoc();

long e1 = PDF.PDFPAGE_CreateControl_Edit("field1", 20, 20, 120, 32);
PDF.PDFANNOTATION_Text = "Some text";

long e2 = PDF.PDFPAGE_CreateControl_Edit("field2", 140, 20, 240, 32);
PDF.PDFANNOTATION_Text = "Other text";

long c1 = PDF.PDFPAGE_CreateControl_Checkbox("check1", 250, 20, 262, 32);

long b1 = PDF.PDFPAGE_CreateControl_Button("but1", 180, 60, 240, 80);
PDF.PDFANNOTATION_Caption = "Submit";
PDF.PDFANNOTATION_OnMouseUp = PDF.CreateSubmitFormAction("http://127.0.0.1", true, TxPDFSubmitType.stGet);

long b2 = PDF.PDFPAGE_CreateControl_Button("but2", 260, 60, 320, 80);
PDF.PDFANNOTATION_Caption = "Hide some...";

long a_hide = PDF.CreateVisibleControlAction(false);
long a_show = PDF.CreateVisibleControlAction(true);

// Now add needed controls to be hidden/shown on button pressed/released
PDF.AddControlToAction(a_hide, e1);
PDF.AddControlToAction(a_hide, c1);
PDF.AddControlToAction(a_hide, b1);
PDF.AddControlToAction(a_show, e1);
PDF.AddControlToAction(a_show, c1);
PDF.AddControlToAction(a_show, b1);

PDF.PDFANNOTATION_OnMouseDown = a_hide;
PDF.PDFANNOTATION_OnMouseUp = a_show;

PDF.EndDoc();
Visual Basic
[copy to clipboard]
' PDF object is supposed to be created
PDF.BeginDoc

e1 = PDF.PDFPAGE_CreateControl_Edit("field1", 20, 20, 120, 32)
PDF.PDFANNOTATION_Text = "Some text"

e2 = PDF.PDFPAGE_CreateControl_Edit("field2", 140, 20, 240, 32)
PDF.PDFANNOTATION_Text = "Other text"

c1 = PDF.PDFPAGE_CreateControl_Checkbox("check1", 250, 20, 262, 32)

b1 = PDF.PDFPAGE_CreateControl_Button("but1", 180, 60, 240, 80)
PDF.PDFANNOTATION_Caption = "Submit"
PDF.PDFANNOTATION_OnMouseUp = PDF.CreateSubmitFormAction("http://127.0.0.1", True, 0)

b2 = PDF.PDFPAGE_CreateControl_Button("but2", 260, 60, 320, 80)
PDF.PDFANNOTATION_Caption = "Hide some..."

a_hide = PDF.CreateVisibleControlAction(False)
a_show = PDF.CreateVisibleControlAction(True)

' Now add needed controls to be hidden/shown on button pressed/released
PDF.AddControlToAction a_hide, e1
PDF.AddControlToAction a_hide, c1
PDF.AddControlToAction a_hide, b1
PDF.AddControlToAction a_show, e1
PDF.AddControlToAction a_show, c1
PDF.AddControlToAction a_show, b1

PDF.PDFANNOTATION_OnMouseDown = a_hide
PDF.PDFANNOTATION_OnMouseUp = a_show

PDF.EndDoc

See Also

PDF Library Download Features Manual Tutorials FAQ Pricing HTML2PDF-X Pilot History In the Lab

 

 

PDF Library | Virtual Printer | Converters to PDF

Support | Blog | Forum | Contacts

© 2000-2012, Two Pilots