OnControlOtherChanged
IPDFDocument4 :: Annotations

See Also Example
Collapse All

This property 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 OnControlOtherChanged { get; set; }
Value
Number of the action

Remarks

The number of the action can be retrieved using the CreateJavaScriptAction method.

Example

Handling OnAnnotOtherControlChanged

Delphi
[copy to clipboard]
{ PDF object is supposed to be created }
a := PDF.CreateJavascriptAction('this.getField("edit2").value = this.getField("edit1").value * this.getField("edit1").value;');

PDF.AddEditBox(10, 10, 90, 24, 'edit1');
PDF.AnnotUnicodeText := '3';

PDF.AddEditBox(10, 30, 90, 44, 'edit2');
PDF.AnnotUnicodeText := '9';
PDF.OnControlOtherChanged := a;

{ Now the square of the edit1 will be calculated }
{ in the edit2 when edit1 is changed. }
PDF.SaveToFile('test.pdf', true);
C/C++
[copy to clipboard]
// PDF object is supposed to be created
long a = PDF->CreateJavascriptAction("this.getField('edit2').value = this.getField('edit1').value * this.getField('edit1').value;");

PDF->AddEditBox(10, 10, 90, 24, "edit1");
PDF->AnnotUnicodeText = L"3";

PDF->AddEditBox(10, 30, 90, 44, "edit2");
PDF->AnnotUnicodeText = L"9";
PDF->OnControlOtherChanged = a;

// Now the square of the edit1 will be calculated
// in the edit2 when edit1 is changed.
PDF->SaveToFile("test.pdf", true);
C#
[copy to clipboard]
// PDF object is supposed to be created
long a = PDF.CreateJavascriptAction("this.getField('edit2').value = this.getField('edit1').value * this.getField('edit1').value;");

PDF.AddEditBox(10, 10, 90, 24, "edit1");
PDF.AnnotUnicodeText = "3";

PDF.AddEditBox(10, 30, 90, 44, "edit2");
PDF.AnnotUnicodeText = "9";
PDF.OnControlOtherChanged = a;

// Now the square of the edit1 will be calculated
// in the edit2 when edit1 is changed.
PDF.SaveToFile("test.pdf", true);
Visual Basic
[copy to clipboard]
' PDF object is supposed to be created
a = PDF.CreateJavascriptAction("this.getField('edit2').value = this.getField('edit1').value * this.getField('edit1').value;")

PDF.AddEditBox 10, 10, 90, 24, "edit1"
PDF.AnnotUnicodeText = "3"

PDF.AddEditBox 10, 30, 90, 44, "edit2"
PDF.AnnotUnicodeText = "9"
PDF.OnControlOtherChanged = a

' Now the square of the edit1 will be calculated
' in the edit2 when edit1 is changed.
PDF.SaveToFile "test.pdf", true

See Also

Reference