Check if the last field is reached – Kofax DOKuStar Validation User Manual

Page 114

Advertising
background image

DOKuStar Validation Programming Manual

Page

110

Check if the Last Field is reached

When the user leaves the last field of the last document in the batch, you could perform some action like displaying a
message box etc.

The check for the last field should be done with respect to the current filter settings. If the user choose only to jump
to empty fields, the last field is another one as if he jumped to all fields.

The

Cursor

object provides a method

LastField

, so this is the easiest way to check for the last field. We use a

Field

object, set it to the last field, and check for its deactivation. Note that this is different to most other examples,

where we use a

FieldType

object for getting events and not a special

Field

. What still needs to be done is to

reassign this

Field

object each time the user changes the filter settings.

Option Explicit

Dim WithEvents dat As Data
Dim WithEvents fld As Field
Dim WithEvents crs As Cursor

Private Sub Application_OnProjectLoaded(ByVal App As Application)
Set dat = App.Project.DataSet.Data
Set crs = App.Project.DataSet.Controller.Cursor
End Sub


Private Sub dat_OnPostImported(ByVal Data As Data)
Set fld = crs.LastField '* set to the last field after importing
End Sub

Private Sub crs_OnChanged(ByVal Cursor As Cursor)
Set fld = crs.LastField '* when the cursor changed, the last field also changed
End Sub

Private Sub fld_OnFieldDeactivated(ByVal Field As Field, ByVal NextField As Field)
Beep '* wake up user
MsgBox "LastField deactivated" '* change to something more useful
End Sub

Advertising