Delphi Pages Forums  

Go Back   Delphi Pages Forums > Delphi Forum > General

Lost Password?

Reply
 
Thread Tools Display Modes
  #1  
Old 09-26-2003, 12:22 AM
akash_govil akash_govil is offline
Member
 
Join Date: Sep 2003
Posts: 36
Default RichEdit Alignment.

I have a Richedit component in my form. At run time i write the data from a text file into the RichEdit box. Now i change the text Alignment property of the RichEdit component. The alignment of the text does not change until I reload the text into the RichEdit box. I want to change the alignment as soon as i change the Alignment property.

Somebody help.
Reply With Quote
  #2  
Old 09-26-2003, 12:34 AM
kalifat kalifat is offline
Senior Member
 
Join Date: Apr 2003
Posts: 623
Default RE: RichEdit Alignment.

Hi akash_govil


RichEdit is an object which let you change Alignment of all setting text or of particulary paragraph.

Then you can use code

RichEdit1.Alignment:=taLeftJustify;
or
RichEdit1.Paragraph.Alignment:=taLeftJustify.

Windows change alignment of selected paragraph.


If you want show all RichEdit text use RichEdit1.Refresh;


Look on following example
To use this example, place a Toolbar and a RichEdit on the form. Right click the toolbar and select New Button three times. Place the ToolButton1Click handling code in the on click event of the first TToolButton, then attach the same OnClick handler for each button.
procedure TForm1.ToolButton1Click(Sender: TObject);
begin
if (Sender = ToolButton1) then
RichEdit1.Paragraph.Alignment := taLeftJustify
elseif (Sender = Toolbutton2) then
RichEdit1.Paragraph.Alignment := taCenter
elseif (Sender = Toolbutton3) then
RichEdit1.Paragraph.Alignment := taRightJustify;
end;
Reply With Quote
  #3  
Old 09-26-2003, 12:49 AM
akash_govil akash_govil is offline
Member
 
Join Date: Sep 2003
Posts: 36
Default RE: RichEdit Alignment.

have already tried doing this but it does not work. The alignment changes only after i reload the text.
Reply With Quote
  #4  
Old 09-26-2003, 01:28 AM
kalifat kalifat is offline
Senior Member
 
Join Date: Apr 2003
Posts: 623
Default RE: RichEdit Alignment.

Hello akash_govil

I don't know why but Alignment parameter working only in Memo component not with RichEdit. Delphi change Alignment parameter for RichEdit but for showing text it using RichEdit.Parameter elements.

You can try use following code
procedure ChangeAlignment(NewAlign:TAlignment);
begin
RichEdit1.SelectAll;
RichEdit1.Paragraph.Alignment:=NewAlign;
end;


Try also call Perform procedure with CM_RECREATEWND parameter.


Good luck!
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On

Forum Jump


All times are GMT. The time now is 10:24 PM.


Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2014, vBulletin Solutions, Inc.