make a button open a URL

this does not work. Nothing happens.

ShowURL("http://www.apple.com ")

what code opens a webpage when you click a button.

thanks.

That should work. What OS are you using and what is your Xojo target?

Works for me in OSX desktop

[quote=219185:@Shawn Brady]this does not work. Nothing happens.

ShowURL("http://www.apple.com ")

what code opens a webpage when you click a button.

thanks.[/quote]

Where did you place that code ? If you put it in the Action event of a button, it will work.

Shawn, do you have a default browser set in the system’s internet options? If not, I’m not sure what ShowURL will do.

my OS is 10.10.5
Safari is default.
is there another way to get a URL to open like making text a link like in a Word Processor.

[quote=219317:@Shawn Brady]my OS is 10.10.5
Safari is default.
is there another way to get a URL to open like making text a link like in a Word Processor.[/quote]

Shawn, that code should work as it is. No need to look for another method. You must be doin something wrong. Once again, where did you put that code ?

I have a button.
There is an “action” for the button.
this code is in the action. ShowURL ("http://www.apple.com ")
its not working

[quote=219319:@Shawn Brady]I have a button.
There is an “action” for the button.
this code is in the action. ShowURL ("http://www.apple.com ")
its not working[/quote]

If a link works in a word processor, it is simply impossible that this code does not work.

You can verify the event has been triggered with something like this before your showURL. If that does not show the MsgBox, something is wrong in your project.

MsgBox "event worked"

lets all sing along:

I’m a moron I’m a moron
I’m a moron, yes I am
I put the code in another button
I’m a moron, oh yes I am

[quote=219329:@Shawn Brady]lets all sing along:

I’m a moron I’m a moron
I’m a moron, yes I am
I put the code in another button
I’m a moron, oh yes I am[/quote]

Come on. You are no more a moron than any one of us and I do not think anybody said so.

So what happened in that other button ?

If I wrote a song for every misstep I took the planet would be deforested.
What scares me is when I check my snippets library and realize I have entered the same trick 6 times over the years.
I’ve taken to wearing a name tag when I go to bed. It is written backwards so I will be able to read it in the morning. It is just a simple tag often seen at conferences only with a twist. “Hello your name is…”
Excuse me, I seem to have misplaced my pants.

LOL!

We’ve all done that. Misplaced code. Misplaced pants. Etc.

[quote=219321:@jean-paul devulder]strange

i made simple example, work for you ?

dl: [/quote]

That URL is invalid. It contains a space.

Nice catch. The universe wins…