FocusChanged
This event triggers each time before the focus inside the verification form changes.
You can modify the focus change by modifying the pNewFieldIndex
parameter.
You can write a different field index into that parameter, which causes Verifier to change to
a specific field instead of the originally selected field. The system triggers this event in
Designer, if you set the Reason
parameter to
CdrBeforeFormLoaded
, and if you enable the option in the
Settings dialog box, on the Compatibility
tab.
Syntax
Document_FocusChanged (pWorkdoc as ISCBCdrWorkdoc, Reason as CdrFocusChangeReason, OldFieldIndex as Long, pNewFieldIndex as Long)
Description | Definition |
---|---|
pWorkdoc | Reference to the currently displayed workdoc. |
Reason | Reason of the current focus change, which can be Tab key, Enter key, mouse click, or initial loading.
Possible values |
OldFieldIndex | Index of the currently selected field. In case of initial loading this -1. |
pNewFieldIndex | Index of the currently selected field. This parameter is modified during the script event to keep the focus in the previous field or set it to another field. |
Sample Code
The following script example demonstrates how to skip the table data validation in Verifier for a table with 2 columns.
Private Sub Document_FocusChanged(pWorkdoc as SCBCdrWorkdoc, Reason as CdrFocusChangeReason, OldFieldIndex as Long, pNewFieldIndex as Long)
Dim theEmptyTable as SCBCdrPROJLib.SCBCdrTable
Dim theEmptyTableField as SCBCdrPROJLib.SCBCdrField
'Initializes table and field references
Set theEmptyTable = _
pWorkdoc.Fields("EmptyTable").Table(pWorkdoc.Fields("EmptyTable").ActiveTableIndex)
Set theEmptyTableField = pWorkdoc.Fields("EmptyTable")
'Makes table object valid
theEmptyTable.CellValid(0,0) = True
theEmptyTable.CellValid(1,0) = True
theEmptyTable.RowValid(0) = True
theEmptyTable.TableValid = True
'Makes table field valid (table object is a part of more generic field object)
theEmptyTableField.Valid = True
theEmptyTableField.Changed = False
'Releases references
Set theEmptyTable = Nothing
Set theEmptyTableField = Nothing
End Sub
Sample code
To trigger the event before the assigned verification form loads, but after the VerificationFormLoad event, enable the "Allow firing of FocusChanged event when loading the verification form" in Designer. For more information, see "Specify compatibility settings" in the Brainware Intelligent Capture Designer Help.
The following sample code shows how to implement the handler for the
CdrBeforeFormLoaded
reason.
Private Sub Document_FocusChanged(pWorkdoc as SCBCdrPROJLib.SCBCdrWorkdoc, ByVal Reason as SCBCdrPROJLib.CdrFocusChangeReason, ByVal OldFieldIndex as Long, pNewFieldIndex as Long)
If Reason = CdrBeforeFormLoaded Then
' Do something...
End If
End Sub