The StarBasic project I'm working on contains some macros to adapt an existing dialogue to a specific situation. The dialogue has been designed in the dialogue editor.
Exporting and importing dialogues is a piece of a cake from within the Basic IDE. But how to achieve the same effect by a macro? How to store a dialogue (in a .xdl file) and later to reload it (from that .xdl file) by a macro?
At this moment the code adapting the dialogue works fine but... a bit slowly. It takes 4-5 seconds before the dialogue pops up. Here some simplified code to illustrate:
Code: Select all
'Creating
oDia = createUnoDialog(DialogLibraries.MyLib.MyDialog)
'Adaption
for n = 1 to 100
oCtrl = oDia.Model.createInstance("com.sun.star.awt.UnoControlFixedTextModel")
'Set position, size, text, textcolor, background color, listeners etc...
...
'Add to dialogue
oDia.Model.insertByName("Ctrl_" + cstr(n), oCtrl)
next n
'Running
action = oDia.Execute
Code: Select all
IF dialogue doesn't (yet) exist THEN
Create dialogue (cfr. supra)
Export dialogue to .xdl file
ELSE
Import dialogue from .xdl file
ENDIF
Run dialogue