49 lines
668 B
Markdown
49 lines
668 B
Markdown
+++
|
|
title = "Eventos"
|
|
weight = 3
|
|
+++
|
|
|
|
|
|
#### Eventos de la hoja.
|
|
|
|
|
|
Obtener una tupla con los eventos soportados por la hoja.
|
|
|
|
```python
|
|
hoja = app.active.active
|
|
nombres = hoja.events.names
|
|
app.debug(nombres)
|
|
```
|
|
|
|
#### Asignar una macro a un evento.
|
|
|
|
```python
|
|
def on_select(source):
|
|
app.debug(source.AbsoluteName)
|
|
return
|
|
|
|
|
|
def main():
|
|
doc = app.active
|
|
hoja = doc.active
|
|
|
|
if 'OnSelect' in hoja.events:
|
|
macro = {'library': 'test', 'name': 'on_select'}
|
|
hoja.events['OnSelect'] = macro
|
|
|
|
return
|
|
```
|
|
|
|
#### Eliminar la asignaciĆ³n del evento.
|
|
|
|
```python
|
|
hoja.events['OnSelect'] = {}
|
|
```
|
|
|
|
O
|
|
|
|
```python
|
|
hoja.events.remove('OnFocus')
|
|
```
|
|
|