Page 1 of 1

How To Set Default Alignment In TRichViewEdit

Posted: Sun Mar 19, 2006 1:26 am
by DickBryant
I would like to know how to set the default alignment of a TRichViewEdit that I'm using as an editor so that it would force, say, centered alignment UNLESS the paragraph was specifically set to something else.

This setting would be set elsewhere in a global options dialog. So what I'm looking for is something like:

RVEdit1.DefaultAlignment := Alignment;

where alignment is rvaLeft, rvaRight, rvaCenter or rvaJustify

So when the rve is cleared and someone begins typing into the editor it would start off being in the default alignment, but could then be selected and changed by regular means.

Thanks,

Dick

Posted: Sun Mar 19, 2006 3:03 pm
by Sergey Tkachenko
If you want to change initial alignment, it's simple.

On clearing:

rve.Clear;
rve.DeleteUnusedStyles(True, True, True);
rve.ParaStyles[0].Alignment := DefaultAlignment;

Posted: Sun Mar 19, 2006 6:11 pm
by DickBryant
Thanks! Just what I was looking for!