Desktop.Open() question

Post

Posted
Rating:
#1 (In Topic #782)
Regular
Diverod is in the usergroup ‘Regular’
Seems I don't understand the proper usage for this. When I try the below

Code

Public Sub Button1_Click()

  Desktop.Open("https://startpage.com/", True)

End
I get nothing.
If I put Startpage - Private Search Engine. No Tracking. No Search History. as the text of a UrlLabel and click on it, it functions properly.
I did check my Components and noticed that gb.desktop is only partially green. (Is that significant?)

I've tried throwing peanut butter at the wall for 2 days and can't get anything to stick! I must be doing something wrong. :?:
Online now: No Back to the top

Post

Posted
Rating:
#2
Guru
BruceSteers is in the usergroup ‘Guru’
It works as expected for me with that url.

do you get a result if you use xdg-open in a terminal?

xdg-open Startpage - Private Search Engine. No Tracking. No Search History.

Desktop.Open() uses xdg-open
Online now: No Back to the top

Post

Posted
Rating:
#3
Regular
Diverod is in the usergroup ‘Regular’

BruceSteers said

It works as expected for me with that url.

do you get a result if you use xdg-open in a terminal?

xdg-open Startpage - Private Search Engine. No Tracking. No Search History.

Desktop.Open() uses xdg-open

Yes, works fine in terminal with xdg-open Startpage - Private Search Engine. No Tracking. No Search History..
I have this in the notes of my UrlLabel

Code

Public Sub ulbStartPage_Click()

  '' If you add the 'gb.desktop' component you can use (this worked with 3.14.3)
  '' After updating to 3.16.3 this crashes and needed the component gb.pcre
  '' sudo apt-get install gambas3-gb-pcre
  '' This now works but opens 2 of the same web page < add Wait = True to correct
   Desktop.Open("https://startpage.com/", True)
    
End

But then I realized that the UrlLabel ignores the Desktop.Open("https://startpage.com/", True) and uses whatever is in the text of the label.
I also didn't understand what the gb.pcre had to do with anything and it's not checked in Project > Components, but it did stop the crashing.

I was just wanting to open a couple different web pages programmatically. If it works for you it makes me wonder if that little green circle to the right of gb.desktop in Project > Components being only half green means I'm missing something?

Thanks for your response.
Online now: No Back to the top

Post

Posted
Rating:
#4
Regular
Diverod is in the usergroup ‘Regular’
I just saw this in my terminal window if it helps.

Code

rodg@rodg-ubuntu:~$ xdg-open https://startpage.com/
rodg@rodg-ubuntu:~$ Gtk-Message: Failed to load module "canberra-gtk-module"
Gtk-Message: Failed to load module "canberra-gtk-module"
/usr/share/libdrm/amdgpu.ids: No such file or directory
Opening in existing browser session.
[7518:7518:0100/000000.902768:ERROR:sandbox_linux.cc(376)] InitializeSandbox() called with multiple threads in process gpu-process.
It did open the browser properly and switched to it, causing me to miss the above.
Online now: No Back to the top

Post

Posted
Rating:
#5
Guru
BruceSteers is in the usergroup ‘Guru’

Diverod said

BruceSteers said

It works as expected for me with that url.

do you get a result if you use xdg-open in a terminal?

xdg-open Startpage - Private Search Engine. No Tracking. No Search History.

Desktop.Open() uses xdg-open

Yes, works fine in terminal with xdg-open Startpage - Private Search Engine. No Tracking. No Search History..
I have this in the notes of my UrlLabel

Code

Public Sub ulbStartPage_Click()

  '' If you add the 'gb.desktop' component you can use (this worked with 3.14.3)
  '' After updating to 3.16.3 this crashes and needed the component gb.pcre
  '' sudo apt-get install gambas3-gb-pcre
  '' This now works but opens 2 of the same web page < add Wait = True to correct
   Desktop.Open("https://startpage.com/", True)
    
End

But then I realized that the UrlLabel ignores the Desktop.Open("https://startpage.com/", True) and uses whatever is in the text of the label.
I also didn't understand what the gb.pcre had to do with anything and it's not checked in Project > Components, but it did stop the crashing.

I was just wanting to open a couple different web pages programmatically. If it works for you it makes me wonder if that little green circle to the right of gb.desktop in Project > Components being only half green means I'm missing something?

Thanks for your response.

Aah yes, you are doing something twice there.
UrlLabel is a clickable link, it's already doing what you are doing. the link is set in the Link field not the Text field (possibly it uses the text field if the link field has not been filled).

your Click event function would make sense for a normal label but not for UrlLabel.
To override the UrlLabel function use Stop Event

Code

Public Sub ulbStartPage_Click()

   Desktop.Open("https://startpage.com/", True)
   Stop Event  ' cancel the standard function of urlLabel
       
End

Or you could just use the shell
Exec ["xdg-open", "Startpage - Private Search Engine. No Tracking. No Search History."]
Online now: No Back to the top

Post

Posted
Rating:
#6
Regular
Diverod is in the usergroup ‘Regular’

BruceSteers said


Or you could just use the shell
Exec ["xdg-open", "Startpage - Private Search Engine. No Tracking. No Search History."]
I think I'll just sidestep the Desktop.Open for now. I think I run a little behind the curve on Gambas updates due to the use of Ubuntu 20.04.3. but I don't really know enough to be sure of that

The above will work great for me, so my problem is Solved.  :D  Thanks Bruce.
Online now: No Back to the top

Post

Posted
Rating:
#7
Guru
BruceSteers is in the usergroup ‘Guru’

Diverod said

BruceSteers said


Or you could just use the shell
Exec ["xdg-open", "Startpage - Private Search Engine. No Tracking. No Search History."]
I think I'll just sidestep the Desktop.Open for now. I think I run a little behind the curve on Gambas updates due to the use of Ubuntu 20.04.3. but I don't really know enough to be sure of that

The above will work great for me, so my problem is Solved.  :D  Thanks Bruce.

You're welcome.

If you want to keep updated i made some utilities to help update to latest gambas versions..

the easiest way on an ubuntu system is to use the PPA method..
 
see the apt repository PPA latest gambas install info here..
/install/ubuntu - Gambas Documentation
There's instructions for adding either the gambas stable release or the latest development branch


Gambas compile and install info…
/install - Gambas Documentation

Some utilities to simplify auto-tools install method..
/installtools - Gambas Documentation
Online now: No Back to the top

Post

Posted
Rating:
#8
Avatar
Regular
stevedee is in the usergroup ‘Regular’

Diverod said

…it makes me wonder if that little green circle to the right of gb.desktop in Project > Components being only half green means I'm missing something?

It means "not finished, but stable"

Fully green means "stable"

Fully white/hollow means "experimental"
Online now: No Back to the top

Post

Posted
Rating:
#9
Regular
Diverod is in the usergroup ‘Regular’

stevedee said

Diverod said

…it makes me wonder if that little green circle to the right of gb.desktop in Project > Components being only half green means I'm missing something?

It means "not finished, but stable"

Fully green means "stable"

Fully white/hollow means "experimental"

Thanks stevedee, that's great info. I had truly been wondering the meaning of the half filled circle.
I see now that if I'd left my mouse over that green circle it would have told me a bit more. :shock:

BruceSteers said

Some utilities to simplify auto-tools install method..
/installtools - Gambas Documentation
Thanks Bruce, I used one of your auto-tools(very,very nice) Simple Upgrade so Gambas should be correct now. Desktop.Open still doesn't work for me so it must be something with Ubuntu. No worries though as "xdg-open" works great.

Thanks to All, RodG
Online now: No Back to the top
1 guest and 0 members have just viewed this.