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

T Lee Davidson t.lee.davidson at ...626...
Sun Nov 23 06:38:55 CET 2014


On 11/22/2014 03:04 PM, Tobias Boege wrote:
> 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

Thank you, Tobi. Those links helped me get right to it. I can now see 
the difference clearly.

I have updated the documentation 
(http://gambaswiki.org/wiki/comp/gb.desktop/desktop/open) based on your 
response.


However, Desktop.Open with Wait=True does not Error.Raise("The action 
has failed") when it should.

On the command-line, `xdg-open doesnotexist.txt` causes an error message 
box to pop up and exits with a status code of 4, which is "The action 
failed." (It sure would be nice if xdg-open provided a --quiet option.)

The following code in a form, when executed, prints no errors:

Public Sub Button1_Click()

   Try Desktop.Open("doesnotexist.txt", True)
   If Error Then Print Error.Text

   Catch
     Print Error.Text

End


So, perhaps the documentation revision I just made is not entirely 
correct in practice.


-- 
Lee
__________

"Artificial Intelligence is no match for natural stupidity."




More information about the User mailing list