Jürgen Schmidt wrote:
Rony G. Flatscher wrote:
Bonsoir Bernard,
Bernard Marcelly wrote:
Example in Basic:
sub doSomething(evt as object)
dim myDialog as object
myDialog = evt.Source.getContext()
end sub
Unfortunately, outside of OOo Basic for dialogs this is not
possible, as the invoked script does not get the event object
supplied (it does not get any arguments for that matter).
Actually, this is not true. After closing the scripting framework
editor in which the macro that should get invoked is loaded, I now
get one argument, the event object. Unfortunately, still I cannot
issue a getContext() successfully (I get the source object from the
event object, though, assuming that it is the commandButton/Button
object). So it is still not possible to get at the xDialog.
I did like this without problem on OOo 2.0.1 / Win XP.
I created a dialog in My Macros, with a button starting a Python
routine also in My Macros. The dialog was started from another
Python routine, and when I pushed the button, the Python event
handler modified a Textfield of the dialog.
Well if you are using an event handler, then it would be a different
use case.
In the case where I have a problem the script to invoke via the OOo
scripting framework is defined in the dialog editor. The
commandButton's key-pressed and mouse-release events get the URL
pointing to the macro which gets invoked/executed (and I can
correctly refer to the appropriate key or mouse event object). So the
question still would be up, how one would proceed to get at the
xDialog object (tried to invoke the method "getContext()" on the
source, but that did not work out, unfortunately).
when you have the event, i would assume that you can query the source
for ...awt.XControl where you can call getContext. The returned object
should be your dialog - query for XDialog.
Well, I get the key resp. mouse event and am able to successfully invoke
the method "source" and receive an XInterface object. But then I am
stuck as that object seems to not have the getContext() method available
to it (as if it was not a com.sun.star.awt.XControl; also tried to carry
out a queryInterface to see whether I would get a XControl).
If it matters: these events are triggered by a commandButton which is
placed on to a dialog which in addition has a label. The dialog is
executed via OOo Basic and invokes the aforementioned script via the OOo
scripting framework, if a KeyPressed or MouseButtonReleased event occurs
with the button control.
Not being able to reflect the object I get via "event~source()" in the
scripting framework invocation environment using Java (cf.
<http://qa.openoffice.org/issues/show_bug.cgi?id=61146>), I am relly
stuck at the moment and would appreciate any other ideas !
Regards,
---rony
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]