Determine space used by memo
Hi guys,
This was answered before and below is the example code I've got. At that
time I had RB5.0 and was told that this code works with 5.5. Now I have 6.01
and this code still doesn't work. It just changes the font size of every
other record(???), not the ones that doesn't fit into predetermined size
(FSpaceAvailable).
Does anyone have any ideas?
Thanks.
Zoran.
--------------
procedure TForm1.ppDetailBand1BeforePrint(Sender: TObject);
begin
ppMemo1.Lines.Clear;
ppMemo1.Lines.Add(plCustomer['Company']);
ppMemo1.Lines.Add(plCustomer['Addr1']);
ppMemo1.Lines.Add(plCustomer['City']);
ppMemo1.Lines.Add(plCustomer['Country']);
ppMemo1.Font.Size := FDefaultFontSize;
ppMemo1.CalcSpaceUsed;
repeat
ppMemo1.CalcSpaceUsed;
if ppMemo1.SpaceUsed > FSpaceAvailable then
begin
ppMemo1.Font.Size := ppMemo1.Font.Size - 1;
messagebeep(0);
end;
until (ppMemo1.Font.Size = 1) or (ppMemo1.SpaceUsed <= FSpaceAvailable);
Table1.Next;
end;
This was answered before and below is the example code I've got. At that
time I had RB5.0 and was told that this code works with 5.5. Now I have 6.01
and this code still doesn't work. It just changes the font size of every
other record(???), not the ones that doesn't fit into predetermined size
(FSpaceAvailable).
Does anyone have any ideas?
Thanks.
Zoran.
--------------
procedure TForm1.ppDetailBand1BeforePrint(Sender: TObject);
begin
ppMemo1.Lines.Clear;
ppMemo1.Lines.Add(plCustomer['Company']);
ppMemo1.Lines.Add(plCustomer['Addr1']);
ppMemo1.Lines.Add(plCustomer['City']);
ppMemo1.Lines.Add(plCustomer['Country']);
ppMemo1.Font.Size := FDefaultFontSize;
ppMemo1.CalcSpaceUsed;
repeat
ppMemo1.CalcSpaceUsed;
if ppMemo1.SpaceUsed > FSpaceAvailable then
begin
ppMemo1.Font.Size := ppMemo1.Font.Size - 1;
messagebeep(0);
end;
until (ppMemo1.Font.Size = 1) or (ppMemo1.SpaceUsed <= FSpaceAvailable);
Table1.Next;
end;
This discussion has been closed.
Comments
Sorry, I did not check the results of the demo carefully enough.
I reworked the demo, please download it again...
http://www.digital-metaphors.com/tips/CalcMemoSpaceUsed.zip
Best regards,
Nard Moseley
Digital Metaphors
www.digital-metaphors.com
Zoran.