Operation Manual
Figure 342: Menus page in Customize dialog
Events
In LibreOffice, when something happens it means that an event occurred. For example, opening a
document, pressing a key, or moving the mouse cursor. LibreOffice allows events to cause a
macro to be called; the macro is then called an event handler. Full coverage of event handlers is
well beyond the scope of this document, but a little knowledge can accomplish much.
Caution
Be careful when you configure an event handler. For example, assume that you
write an event handler that is called every time that a key is pressed, but you make a
mistake so the event is not properly handled. One possible result is that your event
handler will consume all key presses, forcing you to forcibly terminate LibreOffice.
1) Go to Tools > Customize on the main menu bar to open the Customize dialog and select
the Events tab (Figure 343). The events in the Customize dialog are related to the entire
application and specific documents.
2) In Save In, select LibreOffice, or a specific document from the drop down menu to save
your event.
3) A common use is to assign the Open Document event to call a specific macro. The macro
then performs certain setup tasks for the document. Select the desired event and click
Macro to open the Macro Selector dialog (Figure 337 on page 339).
4) Select the desired macro and click OK to assign the macro to the event. The Events page
shows that the event has been assigned to a macro.
Chapter 13 Getting Started with Macros | 351