Hi everyone,

Let me rephrase my original question (as I know I tend to get verbose):
is it at all possible to change the focus of a non-modal dialog (a
UnoControlDialog) using the API? And if not, maybe there is some way of
simulating user input to get the same effect?

Any suggestions welcome :)

Zbigniew Banach


> 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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to