Visit our Sponsor   Visit our Sponsor
delphi3000.com - the free delphi knowledge platform
delphi3000.com - the free delphi knowledge platform
468 Users Online NOW
Have a look at your member-status

connecting people's knowledge


  - Recent ArticlesRSS feed for Recent Articles on delphi3000.com
  - List of All Articles
  - Top Viewed Articles
  - Articles (+Attachem.)
  - Articles Of Interest
  - Categories
  - Top Uploader
  - Search
  - Index

  - My Home
  - Submit an Article
  - My Articles
  - My Personal Data
  - My Bookmarks
  - Activities
  - Login/Logout

  - Sign Up
  - Why Sign Up
  - Newsletter

  - Press
  - Advertise

  - Contact
  - Feedback





Community
Borland
ClubeDelphi
Dr. Bob
UK-BUG
Delphi Meetings
Planeta Delphi







Startblatt.de






Share this article with friendsShare this article with friends
Rate this articleRate this article - to keep the quality of delphi3000.com !
Comment this article or read through previous comments (1)


Right-aligned Edit Field (Merry Christmas)Format this article printer-friendly!Bookmark function is only available for registered users!
a little present to all of you and D3K
Product:
Delphi all versions
Category:
VCL-General
Skill Level:
Scoring:
Last Update:
04/25/2005
Search Keys:
delphi delphi3000 article borland vcl code-snippet edit field right align aligned
Times Scored:
3
Visits:
4001
Uploader: Daniel Wischnewski
Company: Delphi-PRAXiS
Reference: gate(n)etwork
 
Question/Problem/Abstract:
Just a little component to right-align your edit field.
Answer:



Hi folks,

it#s christmas eve and I have a little component for all of you - didn't find one here on D3K. I hope you can use it. It is a edit field, as all of you know, allowing you to right-align the text contained. Save the unit as uEditEx.pas and add it to your Component bar (component menu - add component)

HERE IT GOES
============

unit uEditEx;

interface

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

type
TEditEx = class(TEdit)
private
    FAlignment: TAlignment;
procedure SetAlignment(const Value: TAlignment);
protected
procedure CreateParams(var Params: TCreateParams); override;
public
published
constructor Create(AOwner: TComponent); override;
property Alignment: TAlignment
read FAlignment
write SetAlignment
default taLeftJustify;
end;

procedure Register;

implementation

{R uEditEx.dcr}

procedure Register;
begin
  RegisterComponents('gate(n)etwork', [TEditEx]);
end;

{ TEditEx }

constructor TEditEx.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
FAlignment := taLeftJustify;
end;

procedure TEditEx.CreateParams(var Params: TCreateParams);
const
Alignments: array[TAlignment] of Cardinal =
(ES_LEFT, ES_RIGHT, ES_CENTER);
begin
inherited CreateParams(Params);
Params.Style := Params.Style or {ES_MULTILINE or} Alignments[FAlignment];
end;

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

end.


Ciao and merry christmas,
Daniel

gate(n)etwork





Please rate this article!
Skill level:
BeginnerExpert

Useful:
No!Very!

Overall rating:
PoorExcellent



Comments to this article
Write a new comment
Incorrect code
    Mike Shkolnik (Dec 25 2001 2:20PM)

Daniel,

try to change a PasswordChar property ('*' for example) and test own component.

Hint: "password"'s edit doesn't allow to change an alignment

PS: Merry Christmas and a Happy New Year to you and yours...

With best regards, Mike Shkolnik
E-Mail: mshkolnik@scalabium.com
        mshkolnik@yahoo.com
WEB: http://www.scalabium.com
Respond














 
Sign up to consume product discounts for Bronze memberships !

read more


  Visit our Sponsor

 

  Community Ad of
Peganza
 
   














 







     
  Copyright © 2000 - 2007 delphi3000.com - All rights reserved. Terms of use. || Privacy
delphi3000.com is a service by bluestep.com IT-Services GmbH (Vienna)