Solved

TStringlist and Tstrings

Posted on 2001-07-25
5
1,230 Views
Last Modified: 2007-11-27
Hi!

I have just upgraded from Delphi5 and ReportBuilder 5 to
Delphi6 and ReportBuilder6

It seems to be some changes in RB6 that gives me problems.

Here is my working code for RB5:

SubReports := TStringlist.Create;
ppReportFromTreStruct.GetSubReports(SubReports);
MainChild := TppChildReport(SubReports.ObjectsSubReports.IndexOf('MainPage')]);
 
I get ListIndex Out Of bands when I run this.

In the help form GetSubReports :

Declaration

procedure GetSubReports(aReportList: TStrings);

Description

Returns a list of handles to all of the TppChildReport objects within a report in the Objects property of the TStrings. The Caption of the TppSubReport component is saved in the main property of the TString.


This Means that I should use TStrings instead of TstringList or?

OK I try to change to:

SubReports := TStrings.Create;
  ppReportFromTreStruct.GetSubReports(SubReports);
  MainChild := TppChildReport(SubReports.Objects[SubReports.IndexOf('MainPage')]);
 

Now I get som compiler warnings:
[Warning] Report.pas(708): Constructing instance of 'TStrings' containing abstract method 'TStrings.Clear'
[Warning] Report.pas(708): Constructing instance of 'TStrings' containing abstract method 'TStrings.Delete'
[Warning] Report.pas(708): Constructing instance
of 'TStrings' containing abstract method 'TStrings.Insert'


And the program crashes with Abstract Error on the row:

ppReportFromTreStruct.GetSubReports(SubReports);

Can someone help me out?

0
Comment
Question by:hulken
  • 4
5 Comments
 
LVL 27

Expert Comment

by:kretzschmar
Comment Utility
tstrings or tstringlist doesn't matter,

i guess the porblem is that

SubReports.IndexOf('MainPage')
in
MainChild := TppChildReport(SubReports.Objects[SubReports.IndexOf('MainPage')]);

returns -1

there is no entry 'MainPage'
and -1 is out of bounds of course

meikl ;-)

0
 
LVL 27

Accepted Solution

by:
kretzschmar earned 100 total points
Comment Utility
use tstringlist again, and examine the list you get
0
 
LVL 27

Expert Comment

by:kretzschmar
Comment Utility
>use tstringlist again, and examine the list you get ...
to get the correct naming (maybe all is uppercased now)
0
 

Author Comment

by:hulken
Comment Utility
Thanks.... It was not uppercased but they have done som oterh (stupid) changes in ReportBuilder.
0
 
LVL 27

Expert Comment

by:kretzschmar
Comment Utility
well, glad you get it work,
thanks for the points :-)

meikl ;-)
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now