Hi Dinesh,

Am 30.04.2009 12:03, schrieb Dinesh Chothe:
Hii Marcin,                 thanks a lot. In our case its not a simple swing
dialog, we are providing one
                   JFrame dialog which consists of
  radioButtons,check-Boxes,some buttons etc.
                   By using this dialog we take user inputs and use these
inputs in OO dispatch method.
                    We have already developed this all part using swing and
its working fine expect "modal".
                    So now converting this all swing part to native will be
  relly more cumbersome.
                    Would there be any other simple trick to make it modal?

2009/4/28 Marcin Miłkowski<milek...@o2.pl>


a (dirty) workaround is to create a modal UNO-AWT dialog in a new thread before showing the Swing dialog and to set a flag.
If the Swing dialog ends, then the UNO-AWT dialog must end.

e.g.:
XToolkit xToolkit = (XToolkit) UnoRuntime.queryInterface(XToolkit.class, MCF.createInstanceWithContext(
"com.sun.star.awt.Toolkit", context));

Object dialog = xMCF.createInstanceWithContext("com.sun.star.awt.UnoControlDialog", Context);

Object model = xMCF.createInstanceWithContext("com.sun.star.awt.UnoControlDialogModel", context);

XControlModel xControlModel = (XControlModel) UnoRuntime.queryInterface(XControlModel.class, model);

XControl xControl = (XControl) UnoRuntime.queryInterface( XControl.class, dialog);

xDialog = (XDialog) UnoRuntime.queryInterface(XDialog.class, dialog);

xControl.setModel(xControlModel);

XWindowPeer xWindowPeer = null;

WindowDescriptor desc = new com.sun.star.awt.WindowDescriptor();

desc.Type = com.sun.star.awt.WindowClass.MODALTOP;

xWindowPeer = xToolkit.createWindow(desc);

xControl.createPeer(xToolkit, xWindowPeer);

xDialog.execute();


Regards

Peter

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@openoffice.org
For additional commands, e-mail: dev-h...@openoffice.org

Reply via email to