Desktop.Open() question
Posted
#1
(In Topic #782)
Regular

Code
Public Sub Button1_Click()
Desktop.Open("https://startpage.com/", True)
EndIf 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. :?:
Posted
Guru

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
Posted
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)
EndBut 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.
Posted
Regular

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.
Posted
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 UrlLabelCode
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
EndOr you could just use the shell
Exec ["xdg-open", "Startpage - Private Search Engine. No Tracking. No Search History."]
Posted
Regular

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 thatBruceSteers said
Or you could just use the shell
Exec ["xdg-open", "Startpage - Private Search Engine. No Tracking. No Search History."]
The above will work great for me, so my problem is Solved.
Posted
Guru

Diverod said
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 thatBruceSteers said
Or you could just use the shell
Exec ["xdg-open", "Startpage - Private Search Engine. No Tracking. No Search History."]
The above will work great for me, so my problem is Solved.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
Posted
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"
Posted
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:
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.BruceSteers said
Thanks to All, RodG
1 guest and 0 members have just viewed this.


