Issues upgrading API1 app to API 2

I am upgrading an old app written in 2019r1.1 to 2023r1.1 using Windows 11. After I dragged a listbox from the library to a container, I expected to find the Opening event, but all that comes up is Open which makes me think it is API 1. That is further born out by the GridLinesHorizontal property instead of GridLineStyles. I was expecting that any new controls I add to a window or container would be API 2. How do I fix this?

Another interesting thing is that if I right click on any control (before duplicating or deleting it), the entire window is selected instead of just the control. Thank God for Ctrl-Z to get the window back. Fortunately, the options in the Edit menu work.

1 Like

Upgrading to API 2 ≠ upgrading DesktopControls

1 Like

What Super does this new listbox have? You can always change the Super to be DesktopListbox.

From what I understand if you open a non-DesktopX project into Xojo 2023r1.1 it will add by default non-DesktopX controls

If you add a Window that is DesktopWindow, then the controls should be DesktopControls, but to add a DesktopWindow you need to change the App super from Application to DesktopApplication

Are you wanting to move the whole app to API2 controls as well as moving to latest IDE?

Tim had the answer. I was expecting the Library to contain API 2 controls instead of API 1. Adding Desktop to the super fixes it. Is that a bug I should report or is it the way it is supposed to work?

I think is designed this way.
Mixing controls is not a good idea. For example, on you non-DesktopWindow Window add 5 non-Desktop controls and run this code:

Dim test As Integer = Self.ControlCount

now change 1 control to Desktop control and run the code again. You will get 5 on first run and 4 on second run as a non-Desktop window can’t count Desktop controls in it.


No, not a bug. An app that is API1 will get new API1 controls by default, but you can force them by changing the Super.

If you are after changing the whole app to API2, search for and read previous threads about “API1 to API2”.

While I tend to agree with what you wrote, when I read it from someone else, I see it more like a “mess” in the product :grin:.

1 Like