AV when selecting pageStyle band - remedy included
When we add the pageStyle band to a report in the designer at runtime,
then a DesignLayer is automatically added for this band.
But when we afterwards select the PageStyle band, we get an Access
Violation because the GetDefaultpagelayer function of the PageStyleBand
returned nil. We have solved this by changing the "Count -2" startvalue
of the for statement to "Count -1".
I'm not very sure that this will nog introduce other problems, but it
solved our AV problem.
function TppDesignLayers.GetDefaultPageLayer: TppDesignLayer;
var
liIndex: Integer;
lLayer: TppDesignLayer;
begin
Result := nil;
// get last page layer
for liIndex := Count - 1 downto 0 do
begin
lLayer := GetItemForIndex(liIndex);
if lLayer.LayerType = ltPage then
Result := lLayer;
if Result <> nil then
Exit;
end;
end;
then a DesignLayer is automatically added for this band.
But when we afterwards select the PageStyle band, we get an Access
Violation because the GetDefaultpagelayer function of the PageStyleBand
returned nil. We have solved this by changing the "Count -2" startvalue
of the for statement to "Count -1".
I'm not very sure that this will nog introduce other problems, but it
solved our AV problem.
function TppDesignLayers.GetDefaultPageLayer: TppDesignLayer;
var
liIndex: Integer;
lLayer: TppDesignLayer;
begin
Result := nil;
// get last page layer
for liIndex := Count - 1 downto 0 do
begin
lLayer := GetItemForIndex(liIndex);
if lLayer.LayerType = ltPage then
Result := lLayer;
if Result <> nil then
Exit;
end;
end;
This discussion has been closed.
Comments
the Report | PageStyle menu option and then page style and page layer are
created. I can then select either the Foreground layer or the PageLayer.
Please provide exact steps to reproduce the issue or create a simple example
that we can build and run here in the debugger and send to support@ in zip
format.
The last design layer, (Count-1), should always be the Foreground. In the
simple case when you have two design layers, the PageLayer should be 0 and
Foreground 1.
-
Nard Moseley
Digital Metaphors
www.digital-metaphors.com
Best regards,
Nard Moseley
Digital Metaphors
www.digital-metaphors.com
It seems that one of our users has made the impossible possible (as
users tend to do LOL). In his Report Design, DesignLayer[0] is
ForeGround1, and DesignLayer[1] is PageLayer1.
If I add the PageStyle band to my own report, then DesignLayer[0] is
Pagelayer1 and DesignLayer[1] is Foreground1.
Of course with this order of the pagelayers, GetDefaultPageLayer cannot
find the correct layer if it only looks at DesignLayer[0] ...
gr
Bas
Op 29-5-2012 21:55, Nard Moseley (Digital Metaphors) schreef:
in front. To fix the report, select the PagesStyle node in the report tree.
Use the object inspector to set the OrderIndex property to 0.
-
Nard Moseley
Digital Metaphors
www.digital-metaphors.com
Best regards,
Nard Moseley
Digital Metaphors
www.digital-metaphors.com
to 1 when I press Enter. It looks like the OrderIndex cannot be changed
by hand...
gr
Bas
Op 30-5-2012 18:07, Nard Moseley (Digital Metaphors) schreef:
incorrect order. I created a patch for RB 14.05 that will fix the designer
layer order - when the report loads - forcing the foreground to be the last
layer. Please send an email to support@ and request the patch.
-
Nard Moseley
Digital Metaphors
www.digital-metaphors.com
Best regards,
Nard Moseley
Digital Metaphors
www.digital-metaphors.com