Hi,
I eventually got it to work, and it was due to a typo in the URI which
made the call to not reaching the dispatcher.
The second problem is actually a crash with the awt.Toolkit when the
menu item is being called, which I suspect that the problem lies
somewhere inbetween the VCL and the Toolkit which relies on the former.
Some sample code describing the action:
try {
Rectangle winBounds = new Rectangle();
winBounds.X = 1;
winBounds.Y = 2;
winBounds.Width = 1000;
winBounds.Height = 800;
WindowDescriptor winDesc = new WindowDescriptor();
winDesc.Type = WindowClass.TOP;
winDesc.WindowServiceName = "infobox";
winDesc.Bounds = winBounds;
winDesc.WindowAttributes =
WindowAttribute.CLOSEABLE |
WindowAttribute.SHOW
WindowAttribute.MOVEABLE;
XMultiComponentFactory xMCF =
m_xContext.getServiceManager();
XMultiServiceFactory xMSF = (XMultiServiceFactory)
UnoRuntime.queryInterface(XMultiServiceFactory.class, xMCF);
Object object =
xMSF.createInstance("com.sun.star.awt.Toolkit");
XWindowPeer mWindow =
UnoRuntime.queryInterface(XToolkit.class, xMSF).createWindow(winDesc);
XWindow aWindow = (XWindow)
UnoRuntime.queryInterface(XWindow.class, mWindow);
aWindow.setVisible(true);
//XToolkit serviceToolkit = (XToolkit)
xMCF.createInstanceWithContext("com.sun.star.awt.Toolkit", m_xContext);
//serviceToolkit.createWindow(winDesc);
} catch (com.sun.star.uno.Exception e) {
}
This code receives the call from the dispatcher, and executes when the
menu item is pressed.
Does someone have a clue as to what might be wrong? Code missing?
Best
Per
Carsten Driesner skrev 2010-01-06 12:32:
Per Eriksson wrote:
Hi Carsten,
Carsten Driesner skrev 2010-01-05 10:02:
Hi Per,
I am not sure if I understood your problem correctly. You want to
know how a command which opens a UNO AWT based dialog should look like?
Something like: ".uno:OpenDialog?name:string=MyDialogName"
There is no special command which automatically opens a UNO-AWT
(com.sun.star.awt) based dialog. You can use any command you want
which needs an implementation to load/create and display the dialog.
If your code uses Basic or other scripting languages you have to use
a vnd.sun.star.script URL.
I might have been a little unspecific, what I am trying to do is
understand the syntax and associated behaviour of the URL element and
what it referrers to, and also the procedure of referencing dialogs.
I see several occurances of URLs in the Dev Guide, but is unsure if
they document the same thing?
Hi Per,
I am not completely sure what you want to know. The URL element of a
menu item contains a command URL which references a unique command. A
command is a single action which is implemented by a dispatch
provider. The command URL can be any URL. The framework implementation
tries to find a dispatch provider which can process the URL.
The is no way to directly reference a dialog via a command URL. The
implementation of a command can open a dialog. Currently there is no
OpenOffice.org command available that can open a dialog directly.
I hope that this answer helps you to understand commands better.
Regards,
Carsten
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@framework.openoffice.org
For additional commands, e-mail: dev-h...@framework.openoffice.org
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@framework.openoffice.org
For additional commands, e-mail: dev-h...@framework.openoffice.org