Hello Per,
On Wednesday 06 January 2010, 16:38, Per Eriksson wrote:
> 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.
do you want to show a dialog when a menu item is selected?
If so, there are better ways than creating an AWT window on your own.
By the way, this is an API subject you'd better post in [email protected]
Regards
--
Ariel Constenla-Haile
La Plata, Argentina
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]