Felix E. Klee wrote:

> Try out the following code.  It loads the file "/tmp/bar.sxw" and afterwards 
> displays a message box.  The problem is that the file is loaded in a 
> background window, at least on my system.  I.e. the current window obscures 
> the window with the new document.
> 
>       Sub Test1
>               Dim NoArgs() As New com.sun.star.beans.PropertyValue
>               Dim Service As Object
>               Service = createUnoService("com.sun.star.frame.Desktop")
>               Dim Document As Object
>               Document = Service.loadComponentFromURL("file:///tmp/bar.sxw", _
>                       "_blank", 0, NoArgs())
>               MsgBox "foo"
>       End Sub
> 
> To get rid of the problem I found two solutions, but neither is satisfactory:
> 
> * Don't display the message box
> 
> * Close the window in front by using setVisible:
> 
>   StarDesktop.CurrentFrame().getContainerWindow().setVisible(False)

Bad idea!

> So, what do you suggest? How do I make the window with the new document 
> appear 
> in the foreground? Or, alternatively, how do I lower the current window?

OOo always tries to put a window opened with target "_blank" to the
foreground. If it really appears there and *when it does* is a decision
of the window manager.

It seems that on your system the WM brings the window to front
asynchronously, but before the window comes to front you create the
messagebox and it gets the current front window as its parent. But of
course the messagebox gets the focus so it sends your new window back
before it can come to front.

Which window manager do you use?

Best regards,
Mathias

-- 
Mathias Bauer - OpenOffice.org Application Framework Project Lead
Please reply to the list only, [EMAIL PROTECTED] is a spam sink.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to