PDFANNOTATION_OnOtherControlChanged
IPDFDocument3 :: Actions

See Also Example
Collapse All

This method gets or sets a JavaScript action to be performed when the value of another field changes, thus recalculating the value of the current field.

Syntax

LONG PDFANNOTATION_OnOtherControlChanged { get; set; }
Value
Index of the action

Remarks

The index of the action can be retrieved from any action creating function such asĀ CreateJavaScriptAction.

Equivalent in new interface: IPDFDocument4::OnControlOtherChanged.

Example

OnOtherControlChanged Example

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

a1 := PDF.CreateJavascriptAction('this.getField("edit2").value = this.getField("edit1").value * this.getField("edit1").value;');

PDF.PDFPAGE_CreateControl_Edit('edit1', 10, 10, 90, 24);
PDF.PDFANNOTATION_Text := '3';

PDF.PDFPAGE_CreateControl_Edit('edit2', 10, 30, 90, 44);
PDF.PDFANNOTATION_Text := '9';
PDF.PDFANNOTATION_OnOtherControlChanged := a1;

{ Now the square of the edit1 will be calculated }
{ in the edit2 when edit1 is changed.            }

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

LONG a1 = PDF->CreateJavascriptAction("this.getField('edit2').value = this.getField('edit1').value * this.getField('edit1').value;");

PDF->PDFPAGE_CreateControl_Edit("edit1", 10, 10, 90, 24);
PDF->PDFANNOTATION_Text = "3";

PDF->PDFPAGE_CreateControl_Edit("edit2", 10, 30, 90, 44);
PDF->PDFANNOTATION_Text = "9";
PDF->PDFANNOTATION_OnOtherControlChanged = a1;

// Now the square of the edit1 will be calculated
// in the edit2 when edit1 is changed.

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

long a1 = PDF.CreateJavascriptAction("this.getField('edit2').value = this.getField('edit1').value * this.getField('edit1').value;");

PDF.PDFPAGE_CreateControl_Edit("edit1", 10, 10, 90, 24);
PDF.PDFANNOTATION_Text = "3";

PDF.PDFPAGE_CreateControl_Edit("edit2", 10, 30, 90, 44);
PDF.PDFANNOTATION_Text = "9";
PDF.PDFANNOTATION_OnOtherControlChanged = a1;

// Now the square of the edit1 will be calculated
// in the edit2 when edit1 is changed.

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

a1 = PDF.CreateJavascriptAction("this.getField('edit2').value = this.getField('edit1').value * this.getField('edit1').value;")

PDF.PDFPAGE_CreateControl_Edit "edit1", 10, 10, 90, 24
PDF.PDFANNOTATION_Text = "3"

PDF.PDFPAGE_CreateControl_Edit "edit2", 10, 30, 90, 44
PDF.PDFANNOTATION_Text = "9"
PDF.PDFANNOTATION_OnOtherControlChanged = a1

' Now the square of the edit1 will be calculated
' in the edit2 when edit1 is changed.

PDF.EndDoc

See Also

Reference