Recent

Author Topic: Problems with Rp units when trying to port application from Delphi  (Read 2602 times)

SimDala

  • Newbie
  • Posts: 2
Hi, I'm having problems with these units when trying to port application from Delphi 7.2 to Lazarus 2.2.2:

RpRenderPrinter
RpRenderPreview
RpFormSetup
RpRender
RpRenderCanvas

Is there some good equivalent unit to be used in Lazarus to solve these missing units problem?

The application is also using TeeChart that was inclued in Delphi 7.2.
If I'm correct informed, I need to exchange a license to use TeeChart within Lazarus.

Does someone here know how straight forward this porting issues are?

I unfortunatley do not have any access to a working Delphi environment at the moment, only the source code available.

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 11731
  • FPC developer.
Re: Problems with Rp units when trying to port application from Delphi
« Reply #1 on: October 10, 2022, 11:00:43 am »
A bit of googling shows that rp* is rave reports. Both Rave Reports and TeeChart are third party addons distributed with (some) delphi versions.

Afaik Rave, Fast and Crystal reports were bundled with Delphi as reporting solution one time or another.

The Lazarus default reporting solution has the same pedigree as the Fast Report, so probably there is no easy solution for that, as it seems Rave doesn't sell a Lazarus product. Note that even with Delphi converting with vast version differences is not a breeze either (specially over the D2009 unicode line)

As for TeeChart, there are two options. Migrate to the Lazarus native TACharting solution, or try to obtain a license from Steema (afaik they do have licenses for Lazarus, but that doesn't necessarily make it a slam dunk). 

For relatively light to moderate usage I would consider converting/recreate to TAChart (I routinely do), for heavier usage, you'll have to do some research.


« Last Edit: October 10, 2022, 11:05:18 am by marcov »

SimDala

  • Newbie
  • Posts: 2
Re: Problems with Rp units when trying to port application from Delphi
« Reply #2 on: October 10, 2022, 11:15:32 am »
Yes, thanks a lot for very fast reply.

Sorry for giving the feeling that I hadn't checked anything on other knowledge sources before.

I know that the units are Rave Reports that was a third party addon to Delphi 7.2.

What I didn't found was some information on how to replace the Rp units with some equivalent functionality within Lazarus, but didn't found so much information about that. I was just wondering if there was any good replacement solution within Lazarus to switch to.

I got some suggestions about writing a wrapper to be able to use Rp in Lazarus, but I don't see that as a especially fast solution to the problem and it's hard to do that
without access to a working Delphi environment.

In the case of the TeeChart, I've asked Steema about the license issue and that seems to be a quite straight forward solution but I won't know if there's needed some source coude update or how much that needs to be change to support the other version.

Is the TACharting solution much different from TeeChart? I know it's hard to answer without any specific use case, but just if they're releated in any way or uses some standardised API that can be quite ok to switch between.

I have no needs that the Lazarus version of the software shall be compatible with Delphi in the future, just make the application to be runnable within the Lazarus environment.

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 11731
  • FPC developer.
Re: Problems with Rp units when trying to port application from Delphi
« Reply #3 on: October 10, 2022, 02:09:16 pm »
Yes, thanks a lot for very fast reply.

Sorry for giving the feeling that I hadn't checked anything on other knowledge sources before.

I'm just trying to prepare you that it won't be a simple exchanging of some units in some uses. You'll probably need to really understand what is happening, and what you actually use from both sets components.

An additional problem is that Rave Reports feature list explicitly that it can incorporate teechart charts in its report. So there is possible crosstalk too.

Quote
I know that the units are Rave Reports that was a third party addon to Delphi 7.2.

What I didn't found was some information on how to replace the Rp units with some equivalent functionality within Lazarus, but didn't found so much information about that. I was just wondering if there was any good replacement solution within Lazarus to switch to.

There is Lazreport, which is based on an older, open sourced version of fastreport. Afaik the new version of fastreport (4) also has commercial licensing.

Quote
I got some suggestions about writing a wrapper to be able to use Rp in Lazarus, but I don't see that as a especially fast solution to the problem and it's hard to do that
without access to a working Delphi environment.

That makes it even more difficult, because it hampers investigating how the Delphi side works.

Quote
In the case of the TeeChart, I've asked Steema about the license issue and that seems to be a quite straight forward solution but I won't know if there's needed some source coude update or how much that needs to be change to support the other version.

Is the TACharting solution much different from TeeChart? I know it's hard to answer without any specific use case, but just if they're releated in any way or uses some standardised API that can be quite ok to switch between.

I have no needs that the Lazarus version of the software shall be compatible with Delphi in the future, just make the application to be runnable within the Lazarus environment.

TAChart is roughly similar in build up as TChart, but the devil is, like always in the details.

ccrause

  • Hero Member
  • *****
  • Posts: 933
Re: Problems with Rp units when trying to port application from Delphi
« Reply #4 on: October 10, 2022, 02:14:05 pm »
Is the TACharting solution much different from TeeChart? I know it's hard to answer without any specific use case, but just if they're releated in any way or uses some standardised API that can be quite ok to switch between.
Some properties are named differently, some properties are not supported, and some class structures are organized differently, see this comparison.  Depending on your mix of features used, it may be trivial to moderately difficult to port TeeChart to TAChart. E.g. zoom in TAChart is part of TChartTools, while in TeeChart it is a property of TChart.  If you are moving away from Delphi, then it is IMHO worth it to make the transition to TAChart.  There will be an initial learning curve to get used to the slight differences, but TAChart is a really good charting component.

TAChart wiki documentation

wp

  • Hero Member
  • *****
  • Posts: 12294
Re: Problems with Rp units when trying to port application from Delphi
« Reply #5 on: October 10, 2022, 04:57:50 pm »
In the case of the TeeChart, I've asked Steema about the license issue and that seems to be a quite straight forward solution but I won't know if there's needed some source coude update or how much that needs to be change to support the other version.
Does TeeChart support Lazarus at all? They don't mention LCL support on the website, only VCL/FMX. I do remember that I could test their Lazarus conversion several years ago; runtime code was roughly working but there were issues with the component and property editors at designtime. I don't know what became out of this activity and if they could fix these issues...

Is the TACharting solution much different from TeeChart? I know it's hard to answer without any specific use case, but just if they're releated in any way or uses some standardised API that can be quite ok to switch between.
The basic idea is the same: you have a TChart component, add one or more TChartSeries (or other types) to it, and add data value by calling the series' AddXY method (or similar). However, some properties are named differently or do not exist in TAChart, and sometimes additional components are needed to achieve a given goal. If you consider using the Lazarus automatic Delphi-conversion utility you must be aware that it will probably fail even with the simplest chart form. I'd recommend that you delete the chart from the form to be converted so that the form loads into Lazarus; then add the TChart component from TAChart and build it up anew from the start. I'd also recommend that you write some simple charting programs before beginning the conversion so that you get familiar with TAChart; there are a lot of tutorials to get started.

To demonstrate some differences I wrote a simple BarChart by means of the TeeChart version coming with Delphi7 and converted this project to Lazarus - see attachment. Here is a list of the changes that I had to apply manually:

- Remove these Chart properties from the lfm file: Chart.View3D, Chart.Backwall, Series.XValues Series.YValues, Series.Marks.Arrow.Length (plus probably some more...) - with these the form will not be loaded by Lazarus.
- Set Chart.BackColor to the value of TeeChart's Chart.BackWall.Color
- Set Chart.Title.Visible=true, Chart.Legend.Visible=true, Chart.LeftAxis.Caption.Visible=true, Chart.BottomAxis.Caption.Visible=true (they are false in TAChart, but true in TeeChart)
- Set Chart.Title.Font.Color=clBue (it is clDefault in TAChart (=clWindowText), but clBlue in TeeChart (which looks awful in DarkMode!))
- Enter the Series1.Title and Series2.Title (they are empty in TAChart, but equal to the series name in TeeChart)
- Set the series' Marks.Distance to the value of TeeChart's Marks.Arrow.Length
- Set the series' Marks.Style to smsValue (it defaults to smsNone in TAChart)
- Set the series' Marks.LinkPen.Color to the value of TeeChart's Marks.Arrow.Color (but Delphi7 has a bug here, and draws it only white or black)
- Set the Chart.Margin.Bottom to 0 (default: 4), increase the Chart.Margin.Left and .Right.
- Recalculate the bar series' BarwidthPercent and BarOffsetPercent (they are defined differently)
- There are differences in x axis labelling which require some tricks to resolve (not done in this demo).
- plus probably some more...

I have no needs that the Lazarus version of the software shall be compatible with Delphi in the future, just make the application to be runnable within the Lazarus environment.
That's good. Converting code from Delphi to Lazarus can be quite challenging, but keeping it compatible with both IDEs is the highest challenge of all...
« Last Edit: October 10, 2022, 06:14:06 pm by wp »

 

TinyPortal © 2005-2018