Event handlers

In the previous lesson you created the OnChange event handler for some form controls. What is it?

When working with events in the 1C:Enterprise platform, you need to distinguish between two types of events: events connected to a form and its controls and all the other events.

The difference is that the event handlers related to forms and its controls are assignable, whereas the handlers of all other events are fixed.

A fixed event handler must have a name that matches the event name. This is the only way it can be called when the respective event occurs.

An assigned handler can have a custom name. Simply having a procedure name match the name of a form or its control is not enough to call the event handler procedure with that name. The handler procedure must be explicitly assigned to that event in the property palette.

Therefore any procedure located in a form module can be assigned as a handler of one or several events related to the form or the form controls. In this scenario the procedure name is irrelevant. The only thing that matters is that it is assigned to handle a specific event.

Handlers can be assigned either interactively when you edit the form in Designer, or from 1C:Enterprise script, using the SetAction() method for a form or form control.

Next page: Modules

Be the first to know tips & tricks on business application development!

A confirmation e-mail has been sent to the e-mail address you provided .

Click the link in the e-mail to confirm and activate the subscription.