10.07.2015 Views

Programming Guide - Actian

Programming Guide - Actian

Programming Guide - Actian

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

How You Can Use Data Entry Error HandlersThe following code is the entire error-handling procedure defined in themain_control frame:procedure handlerproc(errorfield = entryfield;errorframe = frameexec;errormessage = varchar(2000)not null) /* b yref() */=beginCurProcedure.beep();if errorfield.DataType = 'date' thenerrormessage = 'You must enter a validdate in this field';elseerrormessage = '';endif;return EH_RESUME;end;Typing incorrect data in any entry field on any frame called by themain_control frame causes the monitor to beep.When invalid data (such as an integer or Feb 31) is typed into a field with adate data type, the handlerproc procedure displays a pop-up message specificto date fields. Similar messages can be customized for other fields, but thisprocedure only beeps when invalid data is entered into a field other than adate field. No error message is displayed for other fields because the errormessage is changed to an empty string.Because the handlerproc procedure returns EH_RESUME, control returns to thecalling frame without searching for other data entry error handlers.The following code from the main_control frame declares handlerproc as aprocedure and establishes it to handle data entry errors:initialize =declarehandlerproc = procedure returning integernot null; /* local procedure */enddeclarebeginCurFrame.DataEntryErrorHandler =CurFrame.Scope.GetProcHandle(name = 'handlerproc');...end;How You Can Pass Control to Another Error HandlerThe another_handlerproc procedure returns EH_NEXT_HANDLER, causingOpenROAD to search the parents of this frame for other data entry errorhandlers. Because the frame that defines the handlerproc procedure is theparent frame, control passes to the handlerproc procedure.Data Entry Error Handling 313

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!