Picture Mask Error Handling in Grid
I am using a picture mask in the grid. I would like to have more user friendly message than the “Invalid input value. Use escape key to abandon changes” that you now get when you do not enter text that does not meet the picture mask. The TwwDbEdit component does have a “AllowInvalidExit” option that allows you to exit the component without getting this message, allowing you to handle invalid input with a more user friendly message when you exit the component. However, when you imbed the control within the grid (using the edit control feature), the “AllowInvalidExit” option does not work when imbedded in the grid. I am asking how to get either get the “AllowInvalidExit” option to work in the grid OR to trap the “Invalid input value …” message and replace with one that is more friendly. I would prefer getting the “AllowInvalidExit” to work, because there are cases when I want to allow exiting the column with error. I’ve tried using the Edit Mask in the database field, but it has its own limitations.
-
You can use the TwwIntl.OnValidationError event and determine your own action on an error there. For instance, you could call the DatabaseError with your own message. Note that your TwwIntl.connected property must be true.
For instance...
procedure TMainDemo.wwIntl1ValidationErrorUsingMask(Sender: TObject; Field: TField; var Msg: string; var DoDefault: Boolean); begin DatabaseError(Field.FieldName + ' bad input'); end;
Please sign in to leave a comment.
Comments
2 comments