Desktopbutton

When I drag a button on my Window-object I should expect getting a Button with Desktopbutton as it’s supperclass.
What I get is the classic button, with Pushbutton as it’s super, while I am working in 2021R3.1. Think I don’t really understand how the migration works at this point. Who can explain this behavior to me ? Thx.
buttons

Is your project a new project created in 2021r3.1 or an existing project opened in this version?

1 Like

The behavior is supposed to be

If you open a project from before 2021r3 the Library will provide classic controls. If you create a new project with 2021r3, you will get Desktop* framework controls.

As far as I’ve seen, the display labels in the Library don’t actually show the difference.

There are glitches here and there. I’ve gotten Desktop* controls when trying to subclass in an older project, but it’s easily corrected by removing the prefix. If you run into a reproducible glitch you could file a feedback ticket.

Thanks Tim. Understood and yes I tested with a new project and it works this way.

But, since most projects in progress are started in earlier versions, think this brings projects in a weird situations when it comes to understanding after a few years from now when you might have to make updates to the project.
Wouldn’t it be better if Xojo provided converting functionality to turn pushbuttons into destopbuttons or even webbuttons.? And so on for other controls. The project knows if it’s a desktop or web project. (??).

Unfortunately his information is also incorrect.

When it comes to controls on a window or container, the control type you get from the library is based on the window/container itself. Old window, old control.

Everything else is based on the super of the App class. Changing the super to DesktopApplication will get you DesktopWindows instead of plain old Windows.

3 Likes

Ah, is this documented somewhere else officially? I had trouble pinning down the behavior too and that was as close as I could discover.

2 Likes

@Greg_O_Lone - Ok, this is how I should expect it to work. But, how is it possible that I have pushbuttons and desktop buttons on one Window ? And if I add another button now I get a pushbutton.

Well, this is it you see. My complaint about the Xojo docs is that there is often insufficent detail.

1 Like

If you right-mouse click on an old control in your project you will see you can have it converted to a new one.

You still have to go through your code and change:

Var xyz as PushButton

to:

Var xyz as DesktopPushButton

My initial guess would be that you started the conversion in a prerelease before these rules were in place.

It’s also possible if you have custom controls that have already been converted or that you’ve converted a window that contains custom controls which have not yet been converted.

Ah, I see. Was not aware op this option in the contextmenu, but it works.

For the project I saw this happening, both is not the case. It’s just a test-gui for a class I am developing. I did not use any prereleases lately.
In case of a serious GUI project I always build custom controls and subclass every single control just to be flexible afterwards. This time I didn’t since it’s just a test-gui. I also did not convert a Window super or whatever.

Since I understand better now how it should work, I keep an eye on it and will get back here if I see things happening different from how it’s designed.

1 Like