[Lazarus] TEditButton alignment
Juha Manninen
juha.manninen62 at gmail.com
Tue Mar 19 10:59:48 CET 2013
On Tue, Mar 19, 2013 at 9:48 AM, Juha Manninen
<juha.manninen62 at gmail.com> wrote:
> It does not compile here. It complains about BiDiMode in
> TEditButtonSpacing.GetSpaceAround.
Ok, I changed it as below and it works. I don't know how you tested
the broken code but it looks very nice.
No widgetset code and the component inherits from TCustomEdit.
The code is also clean, no ugly hacks. Why didn't you show it earlier?
Regards
Juha
-------------------
procedure TEditButtonSpacing.GetSpaceAround(out SpaceAround: TRect);
begin
inherited GetSpaceAround(SpaceAround);
if Control.BiDiMode = bdLeftToRight then
Inc(SpaceAround.Right, TCustomEditButton(Control).ButtonWidth)
else
Inc(SpaceAround.Left, TCustomEditButton(Control).ButtonWidth)
end;
function TEditButtonSpacing.GetSideSpace(Kind: TAnchorKind): Integer;
begin
Result := inherited GetSideSpace(Kind);
if Kind = akRight then
begin
if Control.BiDiMode = bdLeftToRight then
Inc(Result, TCustomEditButton(Control).ButtonWidth);
end
else if (Kind = akLeft) and (Control.BiDiMode <> bdLeftToRight) then
Inc(Result, TCustomEditButton(Control).ButtonWidth);
end;
More information about the Lazarus
mailing list