Hess, Philip J ha scritto:
I agree with Giuliano, so add me to the ranks of the horrified.
TFont.Pitch doesn't appear to be used in any LCL or Carbon widgetset logic, so
that might work. Please be sure to document in the patch that this is used only
as a switch and has nothing to do with mono vs proportional spaced fonts.
Giuliano: I assume that you mean I would need to set my control's canvas
Font.Pitch any time the font changes. That might be a lot of work (120,000
lines of code that I did not write) and having a single switch for the canvas
would be better but I don't see any unused properties in TCanvas. I thought
perhaps the TCanvas.TextFlags could be extended, but the LCL doesn't have
TextFlags the way VCL does.
Maybe I oversimplify, but it seems to me that you could just override
the SetFont method you inherit when you have Font as a property of your
control, and set Pitch := fpFixed, before calling the inherited method.
(of course the SetFont method should become virtual in TControl in order
to make it possible to override it)
IOW:
TMyControl = class (TControl)
......
procedure SetFont(Value: TFont) override;
......
end;
.....
{ TMyControl }
procedure TMyControl.SetFont(Value: TFont);
begin
Value.Pitch:= fpFixed;
inherited SetFont(Value);
end;
and, in TControl, move the SetFont declaration from private to protected
and make it virtual, so that it can be exposed and overriden:
TControl = class(TLCLComponent)
private
.......
protected
procedure Changed;
function GetPalette: HPalette; virtual;
....
procedure SetFont(Value: TFont); virtual;
...
That way whenever the font changes it's set it properly, without need to
bother with the 200.000 lines of code.
That's the beauty of object programming.
Giuliano
_________________________________________________________________
To unsubscribe: mail [EMAIL PROTECTED] with
"unsubscribe" as the Subject
archives at http://www.lazarus.freepascal.org/mailarchives