trichview.com

trichview.support




Re: RVE words


Return to index


Author

Message

Sergey Tkachenko

Posted: 09/14/2003 0:16:18


Download a set of spell checkers:

http://www.trichview.com/resources/spell/rvspell.zip

From this zip file, you need only one unit: RVWordEnum.pas.

This unit contains class that can be used to enumerate words.


Example code:



// Create a new class


type

  TWordColorer = class (TRVWordEnumerator)

  private

    FEdit: TCustomRichViewEdit;

    FCounter: Integer;

  public

    procedure Run(Edit: TCustomRichViewEdit);

    function ProcessWord: Boolean; override;

  end;


function TWordColorer.ProcessWord: Boolean;

begin

  // do something with FWord variable

  inc(FCounter);

  if (FCounter mod 3)=0 then begin

    SelectCurrentWord;

    FEdit.ApplyTextStyle(1); // changing color

    // assuming that the 1st TextStyle is red

    // (or you can use ApplyStyleConversion)

  end;

  Result := True;

end;


procedure TWordColorer.Run(Edit: TCustomRichViewEdit);

begin

  FCounter := 0;

  FEdit := Edit;

  inherited Run(Edit, rvesFromStart);

end;


Using:


procedure TForm1.Button5Click(Sender: TObject);

var wc: TWordColorer;

begin

  LockWindowUpdate(rve.Handle);

  wc := TWordColorer.Create;

  try

    wc.Run(rve);

  finally

    wc.Free;

    LockWindowUpdate(0);

  end;

end;


>

> I have some text in one RVE

>

> I want  :

> 1  to count all words

> 2. to color each third word in red

> 3. to place it to a text file

>

> ...

> putintextfile;

> ...

>

> somewbody help to do the first 2 points, please.

> thank you





Powered by ABC Amber Outlook Express Converter