OnControlKeyPress
IPDFDocument4 :: Annotations

See Also Example
Collapse All

This property gets or sets a JavaScript action to be performed when the user types a keystroke in a text or ComboBox or modifies the selection in a scrollable list. It allows the keystroke to be checked for validity and rejected or modified.

Syntax

LONG OnControlKeyPress { get; set; }
Value
Number of the action

Remarks

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

Example

Handling OnAnnotKeyPress

Delphi
[copy to clipboard]
{ PDF object is supposed to be created }
a1 := PDF.CreateJavascriptAction('this.getField("edit2").value = event.change;');
PDF.AddEditBox(10, 10, 60, 24, 'edit1');
PDF.AnnotUnicodeText := 'edit me';
PDF.OnControlKeyPress := a1;
PDF.AddEditBox(10, 30, 60, 44, 'edit2');
PDF.SaveToFile('test.pdf', true);
C/C++
[copy to clipboard]
// PDF object is supposed to be created
long a1 = PDF->CreateJavascriptAction("this.getField('edit2').value = event.change;");
PDF->AddEditBox(10, 10, 60, 24, "edit1");
PDF->AnnotUnicodeText = L"edit me";
PDF->OnControlKeyPress = a1;
PDF->AddEditBox(10, 30, 60, 44, "edit2");
PDF->SaveToFile("test.pdf", true);
C#
[copy to clipboard]
// PDF object is supposed to be created
long a1 = PDF.CreateJavascriptAction("this.getField('edit2').value = event.change;");
PDF.AddEditBox(10, 10, 60, 24, "edit1");
PDF.AnnotUnicodeText = "edit me";
PDF.OnControlKeyPress = a1;
PDF.AddEditBox(10, 30, 60, 44, "edit2");
PDF.SaveToFile("test.pdf", true);
Visual Basic
[copy to clipboard]
' PDF object is supposed to be created
a1 = PDF.CreateJavascriptAction("this.getField('edit2').value = event.change;")
PDF.AddEditBox 10, 10, 60, 24, "edit1"
PDF.AnnotUnicodeText = "edit me"
PDF.OnControlKeyPress = a1
PDF.AddEditBox 10, 30, 60, 44, "edit2"
PDF.SaveToFile "test.pdf", true

See Also

Reference