The Field_Entry_msg and Field_Exit_msg properties are similar to the Field_Validate_msg and are sent whenever the cursor enters or exits an item connected to a field. You would create the procedures and then assign the procedure names to the field properties. When called, the procedures are passed the field number and field value. While returning a non-zero would stop the navigation event, this would be unusual usage. These procedures are usually used to handle pre-entry or post-exit processing.
Set Field_Entry_msg Field Customer.State To EntryCustomerState
Field_Entry_msg allows you to specify the name of a method that is executed whenever the cursor moves into a data-entry form connected to the field.
The Entry Method, a procedure, can be programmed to perform any action. For example, you might use it to display special information or default values each time the cursor goes to the field for data entry.
In DataFlex, procedures can return an Integer value. In the case of an Entry Method, if a non-zero value is returned, then the cursor movement into the field’s data-entry form is aborted. Using the entry method event to control navigation is strongly discouraged.
The Entry Method should be a member procedure of the Table’s Data Dictionary class.
For example if you have the following member procedure
Procedure EntryOrderDate Integer iField Date dDate
// Add a default date if the field is blank
Boolean bChanged
Get Field_Changed_State iField to bChanged
If (not(bChanged) AND dDate =0) Begin
SysDate dDate
Set Field_Default_Value iField to dDate
End
End_Procedure
To use this procedure on a date field of a file, you would set the field’s Entry Method to EntryOrderDate. You are actually assigning the method handle msg_EntryOrderDate but the “msg” prefix, if omitted, will be supplied automatically.
Set Field_Entry_msg Field Orderhea.Order_Date To EntryOrderDate
The declaration prototype for an Entry Method takes the following general form.
procedure procedureName integer iField type currentValue
procedureName is the name of the procedure;
iField is the field number of the field that sent procedureName. The field number can be used to retrieve any information about the field; and,
type and currentValue are the type and current value of the field that sent procedureName.
The parameters that are passed to the entry method allow you to write generalized entry-method procedures that can be re-used in other fields and tables.
Set Field_Exit_msg Field Customer.Zip To ExitAdjustZip
Field_Exit_msg allows you to specify the name of a method that is executed whenever the cursor moves out of a data-entry form connected to the field.
The Exit Method, a procedure, can be programmed to perform any action. For example, you might use it to adjust the values of some calculated data that is dependent on the field value being entered.
In DataFlex, procedures can return an Integer value. In the case of an Exit Method, if a non-zero value is returned, then the cursor movement out of the field’s data-entry form is aborted. Using the exit method event to control navigation is strongly discouraged.
The Exit Method should be a member procedure of the Table’s Data Dictionary class.
For example if you have the following member procedure
Procedure AdjustDisplayTotal Integer iField Integer iValue
// This updates the extended price field, which will update any
// display balances. This is only done for display purposes. The
// actual amount is updated to the field during the save.
Integer iQty
Number nAmnt
Get Field_Current_Value Field Orderdtl.Qty_Ordered to iQty
Get Field_Current_Value Field Orderdtl.Price to nAmnt
Set Field_Current_Value Field Orderdtl.Extended_Price to (nAmnt *iQty)
// note we set value, but not changed state!
End_Procedure
To use this procedure on the appropriate field of a table, you would set the field’s Entry Method to AdjustDisplayTotal. You are actually assigning the method handle msg_AdjustDisplayTotal but the “msg” prefix, if omitted, will be supplied automatically.
Set Field_Exit_msg Field Orderdtl.Qty_Ordered To Adjust_Display_Total
The declaration prototype for an exit method takes the following general form.
procedure procedureName integer iField type currentValue
procedureName is the name of the procedure;
iField is the number of the field that sent procedureName. The field number can be used to retrieve any information about the field; and,
type and currentValue are the type and current value of the field that sent procedureName.
The parameters that are passed to the exit method allow you to write generalized procedures that can be re-used in other fields and tables.
Defining Data Dictionary Field Attributes