Strikeout...

General TRichView support forum. Please post your questions here
Post Reply
agent86
Posts: 59
Joined: Mon Jun 28, 2010 2:18 am
Location: San Francisco Bay Area, USA
Contact:

Strikeout...

Post by agent86 »

I am using the Rich View Actions Test demo. I want to add Strikeout to the line of buttons. It currently does , Bold, Italic, and Underline.

Here is the procedure that applies them. What do I need to do to add StrikeOut. I already added the button.

procedure TFindingEntry.FontStyleToolButtonClick(Sender: TObject);
var Button: TToolButton;
begin
Button := Sender as TToolButton;
// constants TEXT_BOLD, TEXT_ITALIC and TEXT_UNDERLINE are
// assigned to the tags of corresponding buttons
rve.ApplyStyleConversion(Button.Tag);
end;
Sergey Tkachenko
Site Admin
Posts: 17557
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

If you really use ActionTest demo, it already has a stikeout button linked to srvActionsResource.rvActionFontStrikeout1 action.
You do not need to write any code to make it work.

But I guess you do not use actions but want to add a new button in Editors\Editor 2\ demo.

1) Add a new constant
TEXT_STRIKEOUT = 9;
(value must be unique among other TEXT_* constants in this demo)

2) Add a button btnStrikeOut : TSpeedButton, assign its properties:
- GroupIndex = 5 (because 1..4 are already used),
- AllowAllUp=True,
- Tag = 9 (equals to TEXT_STRIKEOUT)
- OnClick = FontStyleButtonClick

3) In TForm1.rveStyleConversion, add in "case":

Code: Select all

      TEXT_STRIKEOUT:
         if btnStrikeOut.Down then
          FontInfo.Style := FontInfo.Style+[fsStrikeOut]
        else
          FontInfo.Style := FontInfo.Style-[fsStrikeOut];
agent86
Posts: 59
Joined: Mon Jun 28, 2010 2:18 am
Location: San Francisco Bay Area, USA
Contact:

Thanks...

Post by agent86 »

Work great...
Post Reply