DataPlotClasses and xojo 2023 r3

If you have specific questions or problems with any of my Open Source Projects, post them here.
Post Reply
Urban
Posts: 3
Joined: Wed Feb 15, 2017 1:10 pm

DataPlotClasses and xojo 2023 r3

Post by Urban »

Hi Roger,
I am using the DataPlotClasses 1.4.4 in xojo 2023 r3. It looks like the new thread class in xojo and the way to find the parent window has changed.

For some reason the example DataPlot Demo is working fine (except the DUT figure is too small and not locked to the window when changing the size). It compiles without problems. In another example - Adding Traces,Initizing - the traces can't be selected. I also did an example where I can select, but not deselect when using the mouse-down event.

There is also a difference, I think, between using an example and making the project yourself, for example, the simple project at the beginning of the manual.

I use Mac, x86, and the class is used in a xojo container. But I have also done some simple examples in a scratch project, where the compiler complains.

Why is there a difference between the example projects and a scratch project?

Kind Regards,
Urban
User avatar
roger
Site Admin
Posts: 434
Joined: Fri Apr 24, 2009 12:41 am
Contact:

Re: DataPlotClasses and xojo 2023 r3

Post by roger »

Hi Urban,

In the most recent versions of Xojo, new projects use new 2.0 API which use the DesktopWindow instead of the Window control. This requires all controls in these windows to be compatible with DeskTopWindow. You would need to change the superclass of the Figure control to DesktopCanvas (from Canvas). But then you will need to update all event handlers. For example, DesktopCanvas doesn't have an Open event but an Opening event anymore. There will be others. Also, the App is a DesktopApplication instead of Application in new projects, which means it doesn't have a CurrentThread property anymore, so you would need to replace App.CurrentThread with Thread.Current.
It will take a little bit of work to go through all the compile errors you get in a new project, but the documentation is actually pretty helpful in figuring a lot of this out since it still contains information about the pre-2.0 API. You can look up the item it complains about, and in many cases it will tell you that it's been deprecated and what to use instead.

I will eventually overhaul the DataPlotClasses to work with API 2.0 (which will break backwards compatibility, though) at some point, but I don't have the time right now.

BTW, all the example projects are pre-2.0 projects. If you open one of them and build up you app from there, it will always stay a pre-2.0 project and only add pre-2.0 controls. For example, if you drag a new Canvas into the window of an example project, it will add Canvas and not Desktop Canvas.
So, if you don't need your project to be a new 2.0 API project, you can use one of the examples as a starting point for your project.

I hope this helps.

Roger
Urban
Posts: 3
Joined: Wed Feb 15, 2017 1:10 pm

Re: DataPlotClasses and xojo 2023 r3

Post by Urban »

OK, I understand.
I got it to draw with small changes, but some things are not working as intended. I only use it to draw a curve, so it have to do for now. The new API is still hidden in a bit of fog for me.

Kind Regards,
Urban
Post Reply