Hello Per,
On Saturday 09 January 2010, 08:14, Per Eriksson wrote:
> >> I am trying to display an awt window, using the best possible ways, and
> >> would like to get some options.
> >
> > IIRC you wanted to work with awt dialogs...
> >
> >> I've tried using the awt.Toolkit to display an awt window of my own, but
> >> received a tips from Ariel Constenla-Haile at framework that there are
> >> better ways.
> >
> > if you want to show a dialog when a menu item is selected, there are
> > better ways than creating an AWT window on your own.
> >
> >> An example code which I am trying to run is attached below, but
> >
> > this mailing list does not allow attachments (well, sometimes I attach
> > plain source code text files, and pass to the list....)
> >
> >> crashes probably because of handle a related problem.
> >>
> >> What alterantives are there for displaying awt dialogs, for example when
> >> pressing a menu item.
> >
> > [I repeat what I wrote to you privately]
> >
> > basically you have two options:
> >
> > * create a dialog at runtime
> > * create a dialog designed in the OOo Dialog Editor
>
> Thank you for your help.
>
> The tutorial shows how actions are handled, and seem to involve some
> Basic code (because of the script "vnd.sun.star.UNO:doit1").
no, that's not the case.
If you re-read the Dev's Guide, it's clear that in the Dialog Editor, when you
assign an action to an event, instead of choosing "Macro..." you should select
"Component...", and then in "Component method name" you must enter the name of
the method that will be used when the event takes place ("doit1" in this
case).
There is no OOo Basic code involved at all, "vnd.sun.star.UNO:doit1" is just
how the command URL is represented internally
Your class implementing com.sun.star.awt.XDialogEventHandler will then be
invoked with that method's name passed to callHandlerMethod()
Of course, first you have the create the dialog telling which class implements
com.sun.star.awt.XDialogEventHandler . You do this when creating the dialog,
invoking com.sun.star.awt.XDialogProvider2.createDialogWithHandler()
See
http://api.openoffice.org/docs/common/ref/com/sun/star/awt/XDialogProvider2.html#createDialogWithHandler
http://wiki.services.openoffice.org/wiki/Documentation/DevGuide/WritingUNO/Using_Dialogs_in_Components#Instantiate_and_display_a_dialog
I would have thought the SDK example was self-explaining, but it seems it
wasn't (yes... every example should have a little documentation, guiding the
user/developer...).
Try then
http://arielch.fedorapeople.org/devel/ooo/DialogProviderDemo.zip
it's basically the same SDK example but presented - I hope - in a more useful
way (the dialog is created when a menu item under File - Wizards is pressed).
Regards
--
Ariel Constenla-Haile
La Plata, Argentina
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]