List Info

Thread: Unfocussing a non-modal dialog




Unfocussing a non-modal dialog
user name
2007-10-17 14:26:06
Hello folks,

More dialog problems from me, I'm afraid. A quick and
(hopefully) easy
question today. I've created and displayed a non-modal
dialog in the
standard way:

smgr = XSCRIPTCONTEXT.getComponentContext().ServiceManager
ctx = XSCRIPTCONTEXT.getComponentContext()
dialogModel = smgr.createInstance(
             
"com.sun.star.awt.UnoControlDialogModel")
controlContainer = smgr.createInstance(
             
"com.sun.star.awt.UnoControlDialog")
controlContainer.setModel(dialogModel)
toolkit = smgr.createInstanceWithContext(
          "com.sun.star.awt.Toolkit", ctx)
controlContainer.createPeer(toolkit, None)
controlContainer.setVisible(True)

(BTW, I've found that, strangely enough, the setVisible()
call is not
necessary to display the dialog -- createPeer() already does
that).

What I want is to display the dialog from Writer and
immediately restore
focus to the document, so the user can keep typing and use
the info in
the dialog for reference (it's a glossary, FTW) without
having to click
the document or Alt+Tab to it. But after creation, the
dialog is
focussed and I can't find a way to shift focus back to the
main document
window. I've been examining the frame/window properties and
even when
the dialog is focussed, the document frame is still reported
as the top
and active frame, and no combination of setFocus(),
toFront(), toBack()
etc on the dialog or the document window seems to do the
trick.

I hope I'm just missing something trivial here, and I'd
greatly
appreciate a pointer in the right direction.

Cheers,

Zbigniew Banach

------------------------------------------------------------
---------
To unsubscribe, e-mail: dev-unsubscribeapi.openoffice.org
For additional commands, e-mail: dev-helpapi.openoffice.org


[1]

about | contact  Other archives ( Real Estate discussion Medical topics )