Calc TfrxMemoView Width
Im writing a layout generation to print Grid and DataSet Contents, I not sure the best way to calc the Width and the left.
I configure the Designer to use CM as mensure, but if a pass the the CM values, is not good, I copy/past the component in a editor and see that is like screen px, is it?
I usually used the Canvas.TextHeight() and Canvas.TextWidth() functions to calc this, but I dont found and as TfrxMemoView is not TControl derivared I cannot typecast safely.
Iny sugestion, example to do this, in in FR3 framework any function?
[]s
Cesar
I configure the Designer to use CM as mensure, but if a pass the the CM values, is not good, I copy/past the component in a editor and see that is like screen px, is it?
I usually used the Canvas.TextHeight() and Canvas.TextWidth() functions to calc this, but I dont found and as TfrxMemoView is not TControl derivared I cannot typecast safely.
Iny sugestion, example to do this, in in FR3 framework any function?
[]s
Cesar
Comments
I need to fix this with base in TField.DisplayWidth not the content, so the content can be truncated if is larger than Memo.Width, and I use this to calc the left of the next memo.
[]s
but
lTempView.CalcHeight;
lTempView.CalcWidth;
always returns 0 (Zero)
what can be wrong?
[]s
lTempView: TfrxMemoView;
begin
lTempView := TfrxMemoView.Create(nil);
lTempView.Memo.Text:= 'OOOOOOOOOOOOO';
Caption := FloatToStr(lTempView.CalcHeight) + ' ' + FloatToStr(lTempView.CalcWidth);
end
works well.
One note: to calculate height, you should set large Width value to be sure that text lines will not wrap. I.e.
lTempView := TfrxMemoView.Create(nil);
lTempView.Memo.Text:= 'OOOOOOOOOOOOO';
lTempView.Width := 1000;
Caption := FloatToStr(lTempView.CalcHeight) + ' ' + FloatToStr(lTempView.CalcWidth);
[]s