Recent

Author Topic: edit alignment (tacenter, tarightjustify, taleftjusify)  (Read 7311 times)

Anonymous

  • Guest
edit alignment (tacenter, tarightjustify, taleftjusify)
« on: January 12, 2005, 01:04:36 pm »
Code: [Select]

unit SrEdit;

{$mode objfpc}{$H+}

interface

uses
  Classes, SysUtils, LResources, Forms, Controls, windows, LCLType,
  Graphics, Dialogs, StdCtrls, messages;

type
  TSrEdit = class(TEdit)

  private
  fAlignment : TAlignment;

  protected
  procedure SetAlignment(Value: TAlignment);

  public
  procedure createParams(var Params : TCreateParams); override;

  published
  property Alignment: TAlignment read FAlignment write SetAlignment
  default taLeftJustify;

  end;

procedure Register;

implementation

procedure Register;
begin
  RegisterComponents('Standard',[TSrEdit]);
end;

{ TSrEdit }

procedure TSrEdit.SetAlignment(Value: TAlignment);
begin
if FAlignment <> Value then
begin
FAlignment := Value;
RecreateWnd;
end;
end;

procedure TSrEdit.createParams(var Params: TCreateParams);
var
x : Longint;
begin
  inherited createParams(Params);
  case fAlignment of
  tarightjustify: x := es_right;
  taleftjustify : x := es_left;
  tacenter : x := es_center;
  end;
end;

end.



[b]

why is not this code working ?

what is not it writing for right and centre?

sorry I don't know very well english

[/b]