Need A Shape Component with 3 test fields
I am new at component writing, but I have a seating chart that is in report
builder 6.00 and Deplhi 6, that has 100 seats. A seat is a circle with 3
text fields, Seat Number, Name, and County. I would like to build a Report
Builder component to drop on the report that would be the circle and the 3
fields. The 3 fields would need to be exposed so a program can assign
values to them. Can it be done?
builder 6.00 and Deplhi 6, that has 100 seats. A seat is a circle with 3
text fields, Seat Number, Name, and County. I would like to build a Report
Builder component to drop on the report that would be the circle and the 3
fields. The 3 fields would need to be exposed so a program can assign
values to them. Can it be done?
This discussion has been closed.
Comments
TppShape (circle) and three TppDBText components in its constructor. Then
you can move the region around and the four components in the region will
automatically move with it. Disable the region's bounding box. You'll have
to select the different text fields to hook up the data fields from the
datapipeline in the report designer. At runtime, you may rather define the
interface on your class for three properties so that you can set the
datafield names and have them pass through to the three dbTexts. You'll also
need a data pipeline property to pass through to the dbTexts for the runtime
interface support you want to use.
Cheers,
Jim Bennett
Digital Metaphors
http://www.digital-metaphors.com
info@digital-metaphors.com
region from a square to a circle. It looks like in the code for
TppCustomRegion there is a procedure to change the shape, but I don't see
how you would do it.
property to set the ShapeType of the TppRegion ancestor from a descendent.
I've included that change in ppRegion.pas. It won't allow you to use RAP in
this case because the interface section changed. So the alternative is to
implement the ellipse change from the descendent code I have in
TdmRoundRegion and place it in TppRegion in your version of RBuilder\Source
if you want to use RAP. This is just a work around instead of having to
create a property to set the FShapeType. The next release of RB will contain
a the new protected property to support this from a descendent and still be
able to use RAP.
http://www.digital-metaphors.com/tips/RoundRegion.zip
Cheers,
Jim Bennett
Digital Metaphors
http://www.digital-metaphors.com
info@digital-metaphors.com
So, in the circular region, I need 3 labels
---------------
! Label 1 !
! Label 2 !
! Label 3 !
---------------
The reason is, I set in an app, the seat numbers, names, and county of 150
legislators in a seating chart. I'm trying to do this component to
eliminate the number of compents that it takes to do this. You have a
TppShape (thecircle), 3 TppLabels (seat number, names, and county) per
person for a total of 600 compenents. I thought since every seat has the
same 4 components I could do a component.
I can get the region to create, but I can't create the label and get them to
show up. I try setting their Parent and I get this is a read only property.
I just can't seem to can't the labels to show up, more or less get them to
show up in the region box and have the region box be the parent of the 3
labels that need to be there.
I am open to another way of doing this if this sound totally off.
In order to assign the labels to a region, you need to set the
TppLabel.Region := myRegion or Self in this case. That should do the trick.
Cheers,
Jim Bennett
Digital Metaphors
http://www.digital-metaphors.com
info@digital-metaphors.com
TppLabel.Region - is looking for a TppComponent and
myRegion - is a TComponent.
build an example in which a region creates a label embedded in it.
Cheers,
Jim Bennett
Digital Metaphors
http://www.digital-metaphors.com
info@digital-metaphors.com
{---------------------------------------------------------------------------
---}
{In ppRegion Code the declarations
}
{---------------------------------------------------------------------------
---}
TppCustomRegion = class(TppStretchable)
.....
TppRegion = class(TppCustomRegion)
{ TppCustomRegion.Create }
constructor TppCustomRegion.Create(aOwner: TComponent);
begin
inherited Create(aOwner);
CacheRecordSize := SizeOf(TppRegionSaveRec);
...
{---------------------------------------------------------------------------
---}
{ TppRegion.Create }
constructor TppRegion.Create(aOwner: TComponent);
begin
inherited Create(aOwner);
DefaultPropName := 'Caption';
DefaultPropEditType := etAutoEdit;
end;
{---------------------------------------------------------------------------
---}
{---------------------------------------------------------------------------
---}
TppRounedRegion= class(TppRegion)
constructor TppRounedRegion.Create(aOwner: TComponent);
begin
inherited Create(aOwner);
ShapeType := stEllipse;
end;
{---------------------------------------------------------------------------
---}
{---------------------------------------------------------------------------
---}
region I have:
TppLegisSeat = class(TppRounedRegion)
private
FSeatNumber :String;
FSeatName :String;
FSeatCo :String;
FlblSeatNumber :TppLabel;
FlblSeatName :TppLabel;
FlblSeatCo :TppLabel;
constructor TppLegisSeat.Create(aOwner: TComponent);
begin
inherited Create(aOwner);
{create a circle}
Height := 0.6667;
Width := 0.6667;
{Create Name Label}
FlblSeatName := Tpplabel.Create(self);
FlblSeatName.Region := ???????????????????;
What would FlblSeatName.Region be set to?
aOwner is a TComponent, the ppLegisSeat component is not defined and when
using self the label never show up.
I'm still green when it comes to RB components. Thanks for your help.
embedded components in the report designer can only work if the labels
cannot be freed from inside the region by the end user. The report designer
never expects this case when the components are on the same band, unlike a
subreport which is a embedded subreport. I have a region that creates a
label, it can be created and deleted in the designer and the designer can be
shutdown with no destroy bugs. I'll see if I can lock down the labels in the
region so that they are not deletable as a workaround.
Cheers,
Jim Bennett
Digital Metaphors
http://www.digital-metaphors.com
info@digital-metaphors.com