See thats what i thought too was to use the alignment property but i looked every where for that and couldn't find anything to align the text in the edit1 box.
Make sure that you see ALL properties in Object Inspector. Alignment property does exist fo TEditBox. Right click on the object inspector and in "View" submenu check "Visual" (if it's unchecked). Hope that helps.
Azteroth is right you know; I'm lookin', and I ain't seein'. McMerfy, are you sure you haven't got some crazy non-standard TEdit-replacement installed?
Azteroth, if you need right-align, you can use a TLabel. If you need right-align on an actual edit box, maybe a right-aligned oneline TMemo.
Or go to Torry's or one of those places listed down the bottom of Help | Delphi Direct. Have a look through for a custom TEdit replacement control that has what you need. Try to get one free with source. But for me, editing text in a right-aligned box would feel weird. -- Doug Burbidge mailto:dougburbidge@yahoo.com
azteroth
Here is a way to create a right justified edit box. I copied liberally from the Jedi Code for the JVEdit component (free from their home page at:
constructor TRightEdit.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
Parent := TWinControl(AOwner);
end;
procedure TRightEdit.Justify(NewAlignment: TAlignment);
var
FOldEvent: TNotifyEvent;
begin
FOldEvent := OnExit;
try
OnExit := nil;
if FAlignment <> NewAlignment then
begin
FAlignment := NewAlignment;
RecreateWnd;
end;
finally
OnExit := FOldEvent;
end;
end;
procedure TRightEdit.CreateParams(var Params: TCreateParams);
begin
inherited CreateParams(Params);
if Parent <> nil then
case FAlignment of
taLeftJustify:
Params.Style := Params.Style or ES_LEFT;
taRightJustify:
Params.Style := Params.Style or ES_RIGHT;
taCenter:
Params.Style := Params.Style or ES_CENTER;
end;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
RightEdit.Justify(taRightJustify);
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
RightEdit := TRightEdit.Create(Form1);
with RightEdit do
begin
Text := 'Right Justify';
Left := 200;
Top := 200;
Width := 300;
Height := 20;
Enabled := true;
Refresh;
end;
end;
procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);
begin
RightEdit.Free;
end;
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.