Reputation: 438
In a Report designed with fastreport we want to hide or Show an Image Object in the Data Band Depending on the given Data (e.g. a Boolean Property).
I know that I can set the Visibilty of Objects with C# by Adressing the Object by its Name, but inside a DataBand the Object with the Name is there multiple times.
Upvotes: 1
Views: 3543
Reputation: 29993
If I understand your question correctly, next approach may help. I often use this approach, when I want to manipulate objects in databand depending on data.
Just put your logic in OnBeforePrint
event for given band in FastReport editor. Every object (including TfrxPictureView) has a name in FastReport editor and you can access it by this name.
Next example is working:
Pascal Script
procedure MasterData1OnBeforePrint(Sender: TfrxComponent);
begin
Picture1.Visible := (<reportdataset."YourField"> = 'YourValue');
end;
C++ Script
void MasterData1OnBeforePrint(TfrxComponent Sender)
{
Picture1.Visible = (<reportdataset."YourField"> == "YourValue");
}
C# Script
void MasterData1OnBeforePrint(object sender, EventArgs e)
{
Picture1.Visible = ((string)Report.GetColumnValue("reportdataset.YourField") == "YourValue");
}
Upvotes: 3