Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

how to align an edit box...

Posted on 2001-09-16
3
Medium Priority
?
238 Views
Last Modified: 2010-04-06
Hi Guys...

Im writing a simple calculator program. How I can align to the right the edit box like in the windows calculator?

Any ideas?

best regards,
Manuel Lopez (lopem)
0
Comment
Question by:lopem
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 17

Accepted Solution

by:
inthe earned 200 total points
ID: 6486208
hi lopem,
heres the way to add the Alignment settings :
 

unit AlignEdit;

interface

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

type
  TEditAlign = class(TEdit)
  private
    { Private declarations }
  f_alignment: TAlignment;
  protected
    { Protected declarations }
    procedure CreateParams(var params:TCreateParams); override;
  procedure SetAlignment(value: TAlignment);
 public
    { Public declarations }
constructor Create(AOwner: TComponent); override;
  published
    { Published declarations }
 property Alignment:TAlignment read f_alignment write SetAlignment;
 
  end;

procedure Register;

implementation
constructor TEditAlign.Create(AOwner: TComponent);
begin
  inherited create(AOwner);
  end;

procedure TEditAlign.SetAlignment(value: TAlignment);
begin
  if value<>f_alignment then begin
    f_alignment:=value;
    recreatewnd;
    end;
  end;

procedure TEditAlign.CreateParams(var params:TCreateParams);
const
    Alignments : array[TAlignment] of Longint = (ES_LEFT, ES_RIGHT, ES_CENTER);
begin
 inherited CreateParams(Params);
 Params.Style := Params.Style or Alignments[F_Alignment] or ES_MULTILINE;
  end;
procedure Register;
begin
  RegisterComponents('Samples', [TEditAlign]);
end;

end.
0
 
LVL 17

Expert Comment

by:inthe
ID: 6486210
that will give access to alignment property via object inspector or via code ie:

procedure TForm1.FormCreate(Sender: TObject);
begin
 EditAlign1.Alignment := taRightJustify;
// EditAlign1.Alignment := taLeftJustify;
// EditAlign1.Alignment := taCenter;
end;
0
 
LVL 3

Author Comment

by:lopem
ID: 6486213
wow!

what a fast respond!

Thank you

Manuel Lopez (lopem)
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…
Suggested Courses

715 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question