Hi Hal,
don't know if this helps you much, but you can register an event handler
in the dialog editor.
Just right click on a control and look for the tab named 'events' (don't
know if its the exact name in an english version).
There you can choose an event for this control and either write the
macro url by hand in the text-box or choose the macro by browsing via
the button on the right.
There are also methods to register handlers via code, but I think it's
easier in the dialog editor.
bye
Christoph
Hal Vaughan schrieb:
On Sunday 13 July 2008, Oliver Brinzing wrote:
Hi Hal,
I want to do a few things with a dialog from Basic other than just
get the values of some controls.
maybe this helps:
Okay, so to create an event handler for a control in a dialog, I have to
do it in the XML for the dialog itself, is that right? It looks like
there's no way to do that from the dialog editor so I have to load the
IDL file in a text editor on my own to edit it.
Is there some way, from Basic, to give a control an event handler? Or
does it have to be done in the IDL file for the dialog itself?
This helps a lot, now if there's an easier way to attach a handler than
having to edit the IDL by hand every time I make a change in the Dialog
Editor.
Thanks!
Hal
REM ***** BASIC *****
Dim oDialog
Sub Main
oDialog =
CreateUnoDialog(GlobalScope.DialogLibraries.Standard.Dialog1)
oDialog.Execute()
End Sub
Sub TextModified
oDialog.getControl("Label1").setText(oDialog.getControl("TextField1"
).getText()) End Sub
Sub OK
MsgBox "OK"
oDialog.EndExecute()
End Sub
Sub Cancel
MsgBox "Cancel..."
oDialog.EndExecute()
End Sub
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE dlg:window PUBLIC "-//OpenOffice.org//DTD OfficeDocument
1.0//EN" "dialog.dtd"> <dlg:window
xmlns:dlg="http://openoffice.org/2000/dialog"
xmlns:script="http://openoffice.org/2000/script" dlg:id="Dialog1"
dlg:left="183" dlg:top="58" dlg:width="220" dlg:height="169"
dlg:closeable="true" dlg:moveable="true"> <dlg:bulletinboard>
<dlg:button dlg:id="CancelBTN" dlg:tab-index="0" dlg:left="60"
dlg:top="134" dlg:width="55" dlg:height="23" dlg:value="Cancel">
<script:event script:event-name="on-performaction"
script:macro-name="vnd.sun.star.script:Standard.Module1.Cancel?langua
ge=Basic&location=application" script:language="Script"/>
</dlg:button>
<dlg:button dlg:id="OKBTN" dlg:tab-index="1" dlg:left="137"
dlg:top="134" dlg:width="64" dlg:height="21" dlg:value="OK">
<script:event script:event-name="on-performaction"
script:macro-name="vnd.sun.star.script:Standard.Module1.OK?language=B
asic&location=application" script:language="Script"/>
</dlg:button>
<dlg:textfield dlg:id="TextField1" dlg:tab-index="2" dlg:left="60"
dlg:top="63" dlg:width="73" dlg:height="23">
<script:event script:event-name="on-textchange"
script:macro-name="vnd.sun.star.script:Standard.Module1.TextModified?
language=Basic&location=application" script:language="Script"/>
</dlg:textfield>
<dlg:text dlg:id="Label1" dlg:tab-index="3" dlg:left="58"
dlg:top="17" dlg:width="77" dlg:height="18" dlg:value="Label1"/>
</dlg:bulletinboard>
</dlg:window>
OIliver
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]