calculating widths of data-aware components--modified version
I am using Delphi 3.0 Client/Server (it may be 3.02)
with ReportBuilder 3.52 Pro
Based on the code provided in the tech-tips newsgroup, I'm trying to
write some code that will:
- dynamically create ppDBText components based on what fields a user
wants to display in a report
- use a TList to keep track of the created components.
- traverse the records to find the maximum widths for each field (or
each component in the list) in order to set the column widths (component
widths)
For the most part I've got the first two parts working. However, the
columns are not being sized correctly because, while traversing the
data, the Caption property for my ppDBText seem to show the same thing
as the DataField property, for example 'Company' or 'Address'.
I'm opening the ppBDEPipeline and setting it to the first record using
the Open and First methods. And I'm using the Next method to traverse
the data. I figure I'm missing something I need to do in order to read
the Caption correctly for each ppDBText component.
I'm stuck. Any help would greatly be appreciated. Thanks in advance!
This discussion has been closed.
Comments
pipelines. Then you can create all of your components and the report,
before the report is run. Close the datasets and then run the report. The
report will cause the datapipelines to open the datasets and traverse the
data. There is nothing special about the dbText's Caption property.
Instead of creating a TList, just set the band property of the components.
This will cause the bands to take control of the dbTexts, so you won't need
a TList. You can loop through the objects in a band with the bands objects
array property. There is a tech-tip on this in the code-based thread.
Cheers,
Jim Bennett
Digital Metaphors
http://www.digital-metaphors.com
info@digital-metaphors.com