Will converting to API 2 be mandatory in next future?

This has never worked.

2 Likes

I’ll go figure out the particulars as I’m running into this in a project I’m working on in my spare time. (can you believe it? I’m having a Xojo-withdrawal)

1 Like

I just tried it (again) on a clean Big Sur VM with no license for Xojo. Using the template project, I see API 1 and API 2 in autocomplete for FolderItem:

If this is not working for you, it would be great if you could get us the template project you are using so we can look into it.

2 Likes

Various people have tried that and it doesn’t seem to work properly.

For example, this is a comment from Feedback case 57885:

Have just confirmed, the method described here about creating a blank file in a older version of Xojo and adding to Templates folder, doesn’t work.

Upon saving the project, Xojo converts it API 2.0. Which is really weird, because I can open files that I’ve saved with older version of Xojo and save with no problem, so I wonder if it has anything to do with the file being in the Templates folder.

Even if it did work, it is confusing to have the things you want to use classed as deprecated and the things that you don’t want to use listed as the correct way.

We really need a way for API v2 stuff to be completely hidden for a project.

1 Like

I’m curious if the template project I linked above works now for you? That note you refer to from the Feedback case is from 2020 when things were still in pre-release testing.

1 Like

It works fine for me with Xojo 2022r11

1 Like

After step 4 above, working as described:
image

  1. Save your project, a dialog will say “are you sure you want to change the saved project’s minimum IDE version?” and the only way to save is by selecting Yes.
    image

  2. We don’t get the API1 autocomplete anymore
    image

5 Likes

Thanks, Alberto. This points out where the disconnect is.

3 Likes

We have no choice. There is an almost zero probability of us moving to API2 unless forced to at gun point and we have no choice.

Hence the question above because I would think the IDE is in the exact boat we are with it being much more work than realistically possible to make it 100% API2 compliant.

3 Likes

I had a quick play and it did appear to work. What I cannot say is if it fixes the issues I ran into at the time as I became so disenchanted with Xojo and threw away my notes.

It doesn’t help that we get mixed messages regarding support for v1 API. For example, during the last beta I logged 67719 - “API v1 Extension Methods Don’t Auto Complete When Opening An Old Project”. The response I got was that this was not a bug.

And… even if this did all work, it is still not easy work with the v1 API:
• Autocomplete offers v2 methods which makes it easy to make mistakes.
• All v1 API deprecated warnings are added into the current “Item is deprecated. You should use Item2 instead”. It takes 2 minutes for the IDE to build this list for one of our projects.

2 Likes

When working in the IDE we see both API 1 and API 2. Our intent was for you all to have a way to do that as well, but it looks like the template suggestion stopped working in 2021r3 due to a forced upgrade of the project version. I’m looking into what our options are with that.

1 Like

I’ve re-opened case 67719. If you could provide a sample project, it would help us look into it further.

2 Likes

Thanks to all again for the very helpful discussion.

I’ve made my decision: for new projects I’m using api2, and for the existings (and huge and with huge shared code) I’ll wait next summer with the hope of being able to dedicate 2 or 3 days to this conversion.

It’s not a kind of job that fills me with joy, but I have to do it. In the hope that in the future API 3 migration I’ll be retired :rofl:

4 Likes

A sensible decision, Sergio.

1 Like

But since Str is not deprecated and does not raise a warning when you are trying to convert it seems a little unfair to use it as an example of some “problem” with the move to API2.

As you point out, .ToString does not entirely replace the functionality of Str(). Str(42) is acceptable and 42.ToString is not. There are reasons other than compatibility with Visual Basic to keep Str().

I could not find in the documentation that Str() had been retained because of Visual Basic compatibility. Perhaps it exists somewhere or you have inside information or you are coming to this conclusion on your own based on “patterns” of how API2 is different than its predecessor. For now, certainly,

Having to add a temporary variable for the conversion is… annoying, to put it nicely.

does not apply.

1 Like

I know I don’t have to upgrade my project, and I can use API2 whenever it’s helpful. However, not having autofill for API1 syntax in the editor is a HUGE time sink.

2 Likes

The information about their design choices was in one of the forum threads during the initial testing phase. One of the first things they did was come up with a style guide and then find the things that didn’t match. So things like Ceil became Ceiling and HasBackColor became HasBackgroundColor. Str is an odd one because the expanded version would be String, which isn’t acceptable. Format already exists, so their options for renaming were pretty limited. It’s also possible Str was just overlooked and it’ll get changed later, but I think that’s unlikely.

Interestingly, there are no instances of Str in my project at all, which leads me to believe it was originally deprecated, because it’s unlikely I would have caught them all on my own if the analyzer wasn’t warning me about them. That bodes well for it being intentionally spared from the API2 sledgehammer.

1 Like

Interesting…

I found the moment you save the project, it loses the API 1.0, so the next time you open it. it’s API 2.0 only. I filed a bug report and notified Geoff (some time ago about it).

Thank fully Bob’s trick posted on t’other forum has bought back autocomplete and now this daily grating is over for me at least.

4 Likes

You can perfectly well keep your API 1.000 code, and add API 2.00 (which you have autocomplete for) to your project.