Fórum Alinhamento do TEdit a Direita #238731
20/06/2004
0
Como faço para alinhar à direita com o objeto TEDIT ???
Rogério
Rogeranalista
Curtir tópico
+ 0Posts
20/06/2004
Cdaraujo
Logo abaixo criei um pequeno exemplo da re-implementação do componente TEdit, não vi outra forma de fazer isso, tive que implementar essa funcionalidade no componente. Se vc quiser pode utilizar da mesma forma que o código abaixo usa. Vc ainda pode transformar esse código em um componente e instalar em sua paleta para que sempre que precisar vc possa utilizar.
Espero em ter ajudado, qualquer coisa estarei a sua disposição!
Daniel Araújo
--------------------------------------------------------------------------------------
unit UntTeste;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, DB, StdCtrls, Mask, DBCtrls, DBTables;
type
{Novo Componente}
TDBEditAlignment = class(TEdit)
private
{ Private declarations }
FAlignment: TAlignment;
procedure setAlignment(Value: TAlignment);
protected
{ Protected declarations }
public
{ Public declarations }
Constructor Create (AOwner: TComponent);override;
procedure CreateParams(var Params: TCreateParams);override;
property Alignment: TAlignment read FAlignment
write setAlignment default taRightJustify;
end;
TForm1 = class(TForm)
Label1: TLabel;
Edit1: TEdit;
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
DbEditTeste:TDBEditAlignment;
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
{ TDBEditAlignment }
constructor TDBEditAlignment.Create(AOwner: TComponent);
begin
inherited;
FAlignment := taRightJustify;
end;
procedure TDBEditAlignment.CreateParams(var Params: TCreateParams);
const
Alignment: array[TAlignment] of Word = (ES_LEFT, ES_RIGHT, ES_CENTER);
begin
inherited;
Params.Style := Params.Style or Alignment[FAlignment];
end;
procedure TDBEditAlignment.setAlignment(Value: TAlignment);
begin
if FAlignment <> Value then
begin
FAlignment := Value;
RecreateWnd;
end
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
{Cria o novo componente em tempo de execução
e recebe os parâmetros do controle visual}
DbEditTeste := TDBEditAlignment.Create (Self);
with DbEditTeste do
begin
Parent := Self;
Top := Edit1.Top ;
Left := Edit1.Left ;
Width := Edit1.Width ;
Height := Edit1.Height ;
end;//with
end;
end.
Gostei + 0
21/06/2004
Khundalini
[b]Aguardem![/b]
[]s
Rubem Rocha
Manaus, AM
Gostei + 0
21/06/2004
Aroldo Zanela
Colega,
A forma de menor esforço é com RxLib ou Jedi VCL.
Gostei + 0
21/06/2004
Replicante
O AlignEdit(Delphi7 - paleta Standard) não resolveria este problema?
Testei aqui e Ok.
Até mais.
Gostei + 0
21/06/2004
Khundalini
[]
Rubem Rocha
Manaus, AM
Gostei + 0
21/06/2004
Replicante
Gostei + 0
21/06/2004
Beppe
while Memo1.Lines.Count > 1 do Memo1.Lines.Delete(Memo1.Lines.Count - 1);
Gostei + 0
22/06/2004
Tnaires
Alignment: taRightJustify
BevelInner: bvLower
BevelOutter: bvLower
Color: clWindow
E ficava alterando a propriedade Capton, ao invés de Text.
Fica igualzin... :lol:
Gostei + 0
22/06/2004
Tnaires
Gostei + 0
28/01/2016
Marco Antônio
Caso seja basta no OnCreat do form você habilitar a propriedade:
SysLocale.MiddleEast := true;
e nos Edit's que deseja alinhar definir a propriedade 'BidiMode' = bdRightLeft.
créditos: http://www.scriptbrasil.com.br/forum/topic/155485-resolvido%C2%A0como-alinhar-um-edit-a-direita/
Gostei + 0
28/01/2016
Ruy Salles
Não conhecia esta propriedade, testei aqui e funcionou perfeitamente.
Vlw a dica
Gostei + 0
Clique aqui para fazer login e interagir na Comunidade :)