While trying to use the latest API I start looking on the language Reference and while it says
This item was deprecated in version 2021r2 .
Please use GotoURL as a replacement.
for ShowURL, I said that I will give it a try but once I replace it with GotoURL I get
Item does not exist
While on the docs it does say
Desktop and iOS project types of all Desktop, iOS and iPadOS operating systems.
Any idea why it does not work ?
Should I open a feedback case ?
macOS, BigSur 11.5.2, Xojo 2021R2.1
I think some things that were planned to deprecate in 2021r2 were moved to 2021r3, this may be one of those.
It looks like “showurl” does not autocomplete but works. “Gotourl” does not work.
Also GotoURL doc page mention ShowURL:
I don’t know if there is a Feedback case for this, if not, you can open one.
Well, I’m using it. Perhaps you need:
This is the entire content of my CancelLoad event handler, if it helps:
// Called when the content of the HTMLViewer is about to be replaced. If this is due to loading
// an html string into the control, then it seems the URL will be "about:blank". If it happens
// due to the user clicking on a link in the HTMLViewer, we want to show that one. Any links in
// the control will either have no "target" attribute, or it will have been be changed to "_self".
// This will force all clicked links to trigger this event, which then uses GotoURL() to display
// the linked page in the user's browser, rather than here.
// Under Win7 the page loaded from code goes via a temporary file. When an external link is
// clicked, the URL has the normal form, but also another event occurs with the "about:blank" URL.
// For macOS, mailto: is handled by an AppleEvent triggered by the GotoURL. For Win/Lin, it is
// handled via the mailtoWSserver, so nothing should be done here.
if (URL="about:blank" or URL.BeginsWith("file://")=True or URL.BeginsWith("c:\Users\")=True) then Return False
#if (TargetMacOS=False) then
if (URL.BeginsWith("mailto:")=True) then Return True // The HTMLViewer should ignore this request
Maybe it is only a docs bug, instead of just “GotoURL” it is “System.GotoURL”
It works for me if you put the “System.” in front of it, but the documentation doesn’t indicate that the “system.” is required at all. (edit: darn, Alberto beat me to it)
I think it is a docs bug. But perhaps the release notes must have said something, else I wouldn’t have known to use “system” either!
feedback://showreport?report_id=65204 from mid July:
65204 - System doesn’t have a method GoToURL in docs
Steps: The attached screenshot shows the docs for system. When using ShowURL I’m told that System.GoToURL is the replacement. But the method is missing from the docs.
At this point, I have to ask. What was wrong with showURL?
Haven’t a clue what is wrong. Not verb-y enough?
Nothing , just saw it deprecated and I said that I should replace it with the new one to avoid the headache of adapting it later, but I guess it was to early . I’m still using ShowURL for now
Ah, from XOJO point of view ? no idea either, I guess they are adapting the api to fit their needs and add something new to it
in console apps, neither ShowURL nor system.GotoURL exist. The latter autocompletes but fails at compile time. Go figure.
v2021r2.1 on macOS
I suppose nothing change except that we need to add System. before the instruction. For Beep → System.Beep , Xojo kept Beep because it is to much common (I guess).
Neither apply to a console app. Maybe it’s a bug that it autocompletes.
Oh? I did not realize. Why would we not have the capability to invoke URLs from a console app? Works just fine with a shell open command.
Just a midle finger to the the existing users who had to ditch years of experience and relearn the language just because “now looks more modern”