Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

TEdit text alignment....???

0 views
Skip to first unread message

Lauro Lima

unread,
Jun 23, 2000, 3:00:00 AM6/23/00
to
Hi,,,Friends....

I wonder whether I can justify the text when I type inside a TEdit...
The default setting is left to Right But I would like to change it to Right
To Left.
I saw BiDiMode property ... but I didn't Understand... Could Somebody
Help me..


Thanks a lot .

Paulo.


Peter Below (TeamB)

unread,
Jun 23, 2000, 3:00:00 AM6/23/00
to
In article <3953624d@dnews>, Lauro Lima wrote:
> I wonder whether I can justify the text when I type inside a TEdit...
> The default setting is left to Right But I would like to change it to Right
> To Left.
> I saw BiDiMode property ... but I didn't Understand... Could Somebody
> Help me..

BiDiMode is for languages like Hebrew that are written from right to left. If
you just want a right-aligned TEdit use this one, it has an Alignment
property like a TMemo. You have to install this unit into your component
palette.

unit AlignedEdit;

interface

uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls;

type
TAlignedEdit = class(TEdit)
private
fAlignment: TAlignment;
procedure SetAlignment(const Value: TAlignment);
procedure WMGetDlgCode(var Message: TWMGetDlgCode); message
WM_GETDLGCODE;
procedure WMChar( Var Message: TMessage ); Message WM_CHAR;
{ Private declarations }
protected
{ Protected declarations }
Procedure CreateParams( Var params: TCreateParams ); override;
public
{ Public declarations }
published
{ Published declarations }
property Alignment: TAlignment read fAlignment write SetAlignment
default taLeftJustify;
end;

procedure Register;

implementation

procedure Register;
begin
RegisterComponents('PBGoodies', [TAlignedEdit]);
end;

{ TAlignedEdit }

procedure TAlignedEdit.CreateParams(var params: TCreateParams);
const
Styles : Array [TAlignment] of DWORD =
(ES_LEFT, ES_RIGHT, ES_CENTER );
begin
inherited;
params.style := params.style or Styles[ Falignment ] or
ES_MULTILINE * DWORD(Ord( FAlignment <> taLeftJustify));
end;

procedure TAlignedEdit.SetAlignment(const Value: TAlignment);
begin
If fAlignment <> Value Then Begin
fAlignment := Value;
RecreateWnd;
End;
end;

procedure TAlignedEdit.WMGetDlgCode(var Message: TWMGetDlgCode);
begin
inherited;
Message.Result := Message.Result and not DLGC_WANTALLKEYS;
end;

procedure TAlignedEdit.WMChar(var Message: TMessage);
var
f: TForm;
begin
If Message.wparam = 13 Then Begin
f:= TForm(GetParentForm( self ));
If Assigned(f) Then
f.Perform( CM_DIALOGKEY, VK_RETURN, message.lparam );
End
Else
inherited;
end;


end.

Peter Below (TeamB) 10011...@compuserve.com)
No e-mail responses, please, unless explicitly requested!


Enrico P.

unread,
Jun 23, 2000, 3:00:00 AM6/23/00
to
Peter:
would there be a similar function that would help with my bizzarre TEdit problem
in my other posting? (When i create it i set text to '1', for example, but it
does not show, then if i click on the TEdit it shows). Is ther somethign that
ENFORCES drawing of the text in a Tedit?
Thanks
Enrico

Lauro Lima

unread,
Jun 24, 2000, 3:00:00 AM6/24/00
to
Peter....

I want to say tanks.. For you help ... It was exacty what I need.. I
didn't understand all the source code.. But I will

I appreciate it.

Paulo.

Peter Below (TeamB)

unread,
Jun 24, 2000, 3:00:00 AM6/24/00
to
In article <3953E0F0...@sympatico.ca>, Enrico P. wrote:
> would there be a similar function that would help with my bizzarre TEdit problem
> in my other posting? (When i create it i set text to '1', for example, but it
> does not show, then if i click on the TEdit it shows). Is ther somethign that
> ENFORCES drawing of the text in a Tedit?

It's automatic, the only problem that may be related to yours i'm aware of is one
with multiline edit controls (TMaskEdit and TDBEdit are really multiline edits!):
if the controls client area is not high enough to display a line of text without
clippping the control will not display anything. Should be no problem as long as
you have AutoSize set to true (the default) for your edits.

0 new messages