Translation

python_handler.xhp N0665 help.text
English MQUtw
Context English Latvian Actions
python_document_events.xhp
N0724
help.text
Mind the misspelled <literal>_documentEventOccured</literal> method that inherits a typo from %PRODUCTNAME Application Programming Interface (API).
python_document_events.xhp
N0725
help.text
Discovering Documents Events
python_document_events.xhp
bm_id681622445958242
help.text
<bookmark_value>API;frame.GlobalEventBroadcaster: Monitoring Document Event</bookmark_value>
python_document_events.xhp
N0726
help.text
The broadcaster API object provides the list of events it is responsible for:
python_document_events.xhp
N0727
help.text
With Python
python_document_events.xhp
N0734
help.text
""" Display document events """
python_document_events.xhp
N0736
help.text
adapted from DisplayAvailableEvents() by A. Pitonyak
python_document_events.xhp
N0747
help.text
The <link href="https://extensions.libreoffice.org/extensions/apso-alternative-script-organizer-for-python" name="Alternative Python Script Organizer">Alternative Python Script Organizer (APSO)</link> extension is used to render events information on screen.
python_document_events.xhp
N0748
help.text
With %PRODUCTNAME Basic
python_document_events.xhp
N0750
help.text
''' Display document events '''
python_examples.xhp
tit
help.text
Python examples Python piemēri
python_examples.xhp
bm_id20191031405
help.text
<bookmark_value>Python;examples</bookmark_value> <bookmark_value>Python;shell</bookmark_value> <bookmark_value>Python;platform</bookmark_value> <bookmark_value>Python;session</bookmark_value> <bookmark_value>Python;screen input/output</bookmark_value>
python_examples.xhp
hd_id201901031407
help.text
<variable id="pythonexamples2"><link href="text/sbasic/python/python_examples.xhp" name="python examples">Python programming examples</link></variable>
python_handler.xhp
tit
help.text
Creating A Dialog Handler
python_handler.xhp
N0664
help.text
<bookmark_value>Basic;Dialog Handler</bookmark_value> <bookmark_value>Python;Dialog Handler</bookmark_value> <bookmark_value>Access2Base;dlgTrace</bookmark_value> <bookmark_value>Access2Base;_DumpToFile</bookmark_value> <bookmark_value>API;DialogProvider2</bookmark_value> <bookmark_value>API;XDialogEventHandler</bookmark_value>
python_handler.xhp
N0665
help.text
<variable id="pythonhandler_h1"><link href="text/sbasic/python/python_handler.xhp" name="Creating a Dialog Handler">Creating a Dialog Handler</link></variable>
python_handler.xhp
N0666
help.text
Next to <link href="text/sbasic/shared/01040000.xhp" name="Assigning macros to events">assigning macros to events</link> or <link href="text/sbasic/basic/python/python_listener" name="creating event listeners">creating event listeners</link>, one can use dialog handlers, whose principle is to define UNO keywords, or methods, that are mapped to events to watch for. The event handler is responsible for executing methods using the <literal>vnd.sun.star.UNO:<method_name></literal> protocol. Unlike listeners that require to define all supported methods, even if unused, dialog handlers require only two methods on top of intended control hook scripts.
python_handler.xhp
N0667
help.text
The advantages of this approach are:
python_handler.xhp
N0668
help.text
It packs the code that handles event-driven macros,
python_handler.xhp
N0669
help.text
it decorrelates events from macros names which facilitates maintenance or updates, in particular when moving macros or modules.
python_handler.xhp
N0670
help.text
This mechanism is illustrated herewith for Basic and Python languages using an imported copy of <literal>Access2Base</literal> <literal>dlgTrace</literal> dialog. Exception handling and localisation are omitted for clarity.
python_handler.xhp
N0671
help.text
Assigning Dialog methods
python_handler.xhp
N0672
help.text
Export <literal>Access2Base</literal> <literal>dlgTrace</literal> dialog and import it into <literal>MyLib</literal> application library.
python_handler.xhp
N0673
help.text
Inside the control properties pane of the <link href="text/sbasic/guide/create_dialog.xhp" name="Dialog Editor">Dialog Editor</link>, use the Events tab to replace macro assignments by component assignments, and type in the intended method names:
python_handler.xhp
N0674
help.text
Set <literal>Dump to file</literal> dialog button component method name to <literal>_dump2File</literal>
python_handler.xhp
N0675
help.text
Optionally define <literal>txtTracelog</literal> key pressed and mouse button pressed events component method names as <literal>_openHelp</literal>
python_handler.xhp
N0676
help.text
Optionally define <literal>Ok</literal> button receiving focus event component method name as <literal>onOkHasfocus</literal>
python_handler.xhp
N0677
help.text
Events assigned actions should mention the <literal>vnd.sun.star.UNO:</literal> protocol.
python_handler.xhp
N0678
help.text
Creating the handler
python_handler.xhp
N0679
help.text
<literal>createDialogWithHandler</literal> method of <link href="https://api.libreoffice.org/docs/idl/ref/servicecom_1_1sun_1_1star_1_1awt_1_1DialogProvider2.html" name="com.sun.star.awt.DialogProvider2">com.sun.star.awt.DialogProvider2</link> service is used to set the dialog and its handler. The handler is responsible for implementing <link href="https://api.libreoffice.org/docs/idl/ref/interfacecom_1_1sun_1_1star_1_1awt_1_1XDialogEventHandler.html" name="com.sun.star.awt.XDialogEventHandler">com.sun.star.awt.XDialogEventHandler</link> interface.
python_handler.xhp
N0680
help.text
All component method names must be explicitly declared when using a dialog handler.

Loading…

No matching activity found.
Browse all component changes

Glossary

English Latvian
No related strings found in the glossary.

String information

Context
python_handler.xhp
N0665
help.text
Source string description
MQUtw
Source string location
python_handler.xhp
String age
3 years ago
Source string age
3 years ago
Translation file
lv/helpcontent2/source/text/sbasic/python.po, string 135