trichview.com

trichview.support




Re: How to use this component?


Return to index


Author

Message

Sergey Tkachenko

Posted: 07/20/2003 16:15:18


1) If you want only two types of text (normal and bold), do the following:

- in Delphi, double click RVStyle component. You'll see a collection of text

styles

- delete all styles except for two; set font of these styles - normal for

the first style (index=0), bold for the second style (index=2)

- add "Bold" button (TSpeedButton) for switching normal and bold text:

procedure TForm1.SpeedButton1Click(Sender: TObject);

begin

  if SpeedButton1.Down then

    RichViewEdit1.ApplyTextStyle(1)

  else

    RichViewEdit1.ApplyTextStyle(0);

end;

- process TRichViewEdit.OnCurTextStyleChanged

procedure TForm1.ichViewEdit1CurTextStyleChanged(Sender: TObject);

begin

  SpeedButton1.Down := RichViewEdit1.CurTextStyleNo<>0;

end;

This code is from the demo Demos\Delphi\DB Demos\1 DBRichViewEdit\

(and I do not think that the code above is overcomplicated :)


2) You can use RichViewActions http://www.trichview.com/resources/actions/

You can just add TrvActionFontBold action, assign it to some button/menu

item, and all will work without writing any code.

If you never worked with actions before, I can explain more detaily.

But RichViewActions is quite a large project, it includes many built-in

forms, so it may noticeably increase exe file size (it is ok is you want to

build more or less complete word processor, but may be it's an overkill for

only one "Bold" button)


3) If you do not want using RichViewActions, but want to implement several

commands like "Bold", "Italic", "Change font", "Change font color", etc.,

look at the demo Demos\Delphi\Editors\Editor 2\

It is not very complicated, but it may takes a time to study it.




> > All I need is to enter simple text, make some of it bold and then

finally

> > print the text.

> >

> > The libray seems to be rather complicated?

> >

> > Regards,

> > Ole

>

> It's very comprehensive but that's why people love it. You can almost

> build a complete Word application with it.

>

> You might want to try the additional RichViewActions package and you

> won't have to type a lot of code at all.

>

> Regards

> Yoerdes

>





Powered by ABC Amber Outlook Express Converter