[Gambas-user] Desktop.Open [,Wait], what does it do?

Tobias Boege taboege at ...626...
Sat Nov 22 21:04:08 CET 2014


On Sat, 22 Nov 2014, T Lee Davidson wrote:
> Hi,
> 
> Desktop.Open is quite a handy utility. Thank you for that, Beno??t.
> 
> 
> But now can anyone help me understand what Desktop.Open, with Wait=True, 
> does?
> 
> The Gambas documentation does not say, and the 'xdg-open' documentation 
> gives no mention of it.
> 
> I thought perhaps it might cause Desktop.Open to wait until the opened 
> application terminates. But it does not.
> 
> I have tested it with Wait set to True and False, and with image and 
> text files. And, the only difference I see is that Wait=True causes only 
> a slight delay before Desktop.Open returns.
> 
> In both cases (True or False), Desktop.Open returns before the 
> application fully launches and becomes the active window.
> 
> 
> One more thing to clarify. Am I correct in assuming that since it is 
> optional, the default would be False?
> 

Apparently it waits for the xdg script to terminate. There is no relation to
the actually launched application -- the xdg script can a priori terminate
before the application window emerges, or it can terminate even after the
launched application did (if it's very short-lived), or everything between
these extremes.

But when Wait = True, Desktop.Open() tries to report errors that happened
during running the xdg script. You can answer these questions yourself, too,
if you care to do that, by looking at the source code. gb.desktop is written
in Gambas. The particular sources I got these answers from are [0] and [1].

Regards,
Tobi

[0] http://sourceforge.net/p/gambas/code/HEAD/tree/gambas/trunk/comp/src/gb.desktop/.src/Desktop.class
[1] http://sourceforge.net/p/gambas/code/HEAD/tree/gambas/trunk/comp/src/gb.desktop/.src/Main.module

-- 
"There's an old saying: Don't change anything... ever!" -- Mr. Monk




More information about the User mailing list