ListBox events? Arrrgghhh!

Just updated to 2023R3.1 during the sale. I know that lots of changes have happened since my long suffering 2019 but this seems totally bizarre!

Very first action is to try to bring my ListBoxes up to date in my current project. I HAD a CellClicked event. I looked up in the new help system (will reserve comments on that until later). It tells me that the following are available:

CellPressed
DoublePressed
MouseDown

Any of these MIGHT be useful for the task I have (selecting a cell for editing). BUT, when I try to add an event, I ONLY get:

DoubleClick

What gives? Even the mismatch between DoublePressed and DoubleClick is cause for concern. A ListBox is a key control and there is such a huge difference between the documentation and the implementation? My first experience does not instill the Xojo/RB (since RB0.9) confidence I have previously experienced! Previous upgrades have been pretty painless but this is starting to look like a rewrite! Not thrilled, yet!

Should say MacOS Monterey on Intel silicon (iMac 19,1).

1 Like

Your old Listboxes should have the same events as always.
If you now use a DesktopListbox then the new events apply.

Are you creating a new project or are you working with an old project (from Xojo 2019)?

1 Like

If you already have a CellClicked event implemented, you cannot also implement CellPressed.

I personally wouldn’t try updating a 2019 project to 2023 DesktopXYZ controls. There really is no reason to at this time.

In order to get used to the new API 2 controls, start with a fresh project and play around with them. Start small and build.

2 Likes

Old project! When I select the listbox name, it says super is ListBox. When I right click the control name and choose Add an Event, it does seem to give the old event list. But something is going wrong in populating a popup (from a database). Must be something else going on.

So, how do a get a language reference for the older API?

Thanks for the fill!

Jim

Keep Xojo 2019 installed and select ‘Use built-in documentation’ or search the deprecated section on the new documentation.

Also worth noting, on the coding tab of the preferences there is an option to have the autocomplete include the deprecated items along with the API2 ones, which may be of help. It generally does include them anyway on an older API1 project.

there should be a few menus update controls to api 2 or update event names.
handle with care and backup the project first.

Thanks, Ian.

Well it looks like I am having the same problem with the ListBox CellClick event that I did in 2019.

If I have a few simple statements (inside the event method) such as

Me.CellTypeAt(row, column) = ListBox.CellTypes.TextField
Me.EditCellAt(row, column)

It executes just fine with the clicked ListBox cell selected. BUT if I add a breakpoint on either of those lines, the cell is no longer selected. This really hampers debugging!

It also fails if I add a method call and there is a breakpoint inside the called method.

Jim

Remember that you have 90 days to return it :sweat_smile:

I tried the last release, besides all the silly renaming and the extra work with no beneffits, it was painfully SLOW. Better to stick with my 2019r2.1

1 Like

It might have to do with the app being deactivated, because the IDE is brought to the front since the breakpoint is meant for that. Once deactivated, the app invalidates the focus.
There are rare times where breakpoints aren’t the best way to debug.

Also, remember you always have the option to convert your project to API2, if you wish.

Well, what do you expect? Your first step should be to change the Super of the listbox to DesktopListbox. Then you’ll see the new events. You can’t rename an event so you have to copy/paste the code from CellClicked into CellPressed. Then delete CellClicked. Tedious but doable.

The API 1 controls are not changing anymore, they’re deprecated. Only the new Desktop controls are will get updates.

You can try converting instead of changing the Super. Please backup first and test often. This way you don’t need to manually add the renamed events, copy your code and delete the old events:
ezgif.com-video-to-gif (44)

1 Like

You can also convert a whole window to API 2 by right clicking on the window and choosing convert. One warning though. You cannot have an API 1 menu on and API 2 window and vice versa. So you will have to duplicate the your menu and convert that, using that on the API windows.

my experience was that the convert by xojo context menues to Desktop… and API2 or Event Names
was much better than manually one by one.

2 Likes

Sometimes you can get around focus related issues by using remote debug, even on the same machine. Don’t know if that applies here, but it may be worth a try.

Thanks for the comments and Tim’s suggestion. I never used Remote Debugging but this might be worth the efforts. Appreciate the idea.

Jim

The transition to a different language can be scary and frustrating, but if you transition to the right language, it is also incredibly rewarding.

It is a great feeling getting something back as a reward for your efforts.

1 Like

This worries me a lot. I don’t want to waste my time switching from 1 to 2 and then trying to spot what needs ‘fixing’ as a result.

3 Likes

As others have said the deprecated controls are there for a very long time. The IDE would have to be converted before they’ll ever be removed. That would be a massive undertaking.

That said if you have found a bug in the API 1 control it is unlikely to be fixed at which point you would need a workaround or to change to API 2. Given how long the API 1 controls have been around it seems unlikely that they can’t be made to work correctly.