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 is the complete code for the another_handlerproc procedure:procedure another_handlerproc(errorfield = entryfield;errorframe = frameexec;errormessage = varchar(2000) not null) =declarestr = varchar(100) not null;enddeclarebeginmessage 'Error in field' + errorfield.Name +HC_NEWLINE +errormessage;return EH_NEXT_HANDLER;end;Although this procedure uses the message statement to compose the errorinformation, the text of the message is written to the w4gl.log file rather thandisplayed in a pop-up frame. Statements that normally cause display of a popupframe (such as the message statement and the ConfirmPopup method)perform differently when executed from within a data entry error handler. Fora discussion of other restrictions, see Restrictions on Data Entry Error Handlers(see page 315).The following statement from the frame's initialize block establishes theanother_handlerproc procedure as its error handler:CurFrame.DataEntryErrorHandler =CurFrame.Scope.GetProcHandle(name ='another_handlerproc');Example—How Data Entry Error Handler Hierarchy WorksBecause this frame is called by the parent frame that defined the handlerprocprocedure, the following process occurs if a user enters an erroneous value inan entry field in the child frame:1. The another_handlerproc procedure is called and it writes the name of theerror-triggering field, as well as the standard error message, into the logfile or trace window.2. The handlerproc procedure is called (because the another_handlerprocprocedure returns EH_NEXT_HANDLER), and it does the following:• Beeps• Displays a pop-up message only if the data type of the error field isdate• Returns control to the child frame (because it returns EH_RESUME)314 <strong>Programming</strong> <strong>Guide</strong>

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

Saved successfully!

Ooh no, something went wrong!