Page 1 of 1

set the paragraph at left,center,or right

Posted: Thu May 04, 2006 2:51 pm
by kkkdady
I want to set the paragraph at left,center,or right.but it changed must after press a Keyword or the mouse press on it.Could you get me some advice. The codes are following:
void __fastcall TForm1::Button1Click(TObject *Sender)
{
if(Sender == Button1)
RVStyle1->ParaStyles->Items[RichViewEdit1->CurParaStyleNo ]->Alignment = rvaLeft;
if(Sender == Button2)
RVStyle1->ParaStyles->Items[RichViewEdit1->CurParaStyleNo ]->Alignment = rvaCenter;
if(Sender == Button3)
RVStyle1->ParaStyles->Items[RichViewEdit1->CurParaStyleNo ]->Alignment = rvaRight;

}
Thank you!

Posted: Thu May 04, 2006 7:43 pm
by Sergey Tkachenko
This code is not correct.
It changes properties of the current paragraph style. But this style may be used not only by the current paragraph, but by other paragraphs too.
And these changes become visible only after document reformatting.
And these changes cannot be undone/redone by user.

You should use ApplyParaStyleConversion method and OnParaStyleConversion event.
See the demo in
Demos\CBuilder\Editors\Editor 2\

reply

Posted: Fri May 05, 2006 3:15 am
by kkkdady
Thank you! I have known how to use it!