Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

TStringlist and Tstrings

Posted on 2001-07-25
5
Medium Priority
?
1,263 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
5 Comments
 
LVL 27

Expert Comment

by:kretzschmar
ID: 6316379
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 300 total points
ID: 6316384
use tstringlist again, and examine the list you get
0
 
LVL 27

Expert Comment

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

Author Comment

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

Expert Comment

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

meikl ;-)
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…
Suggested Courses

715 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