WPCubed Product Support

Auto-selecting words

I would like to add a feature where the user can select a menu item and WPTools selects a given # of words automatically from the start of the current line/paragraph.

Are there any built-in functions to traverse x # of words? Or better yet - to select x # of words?

Any help appreciated.

Alan

#1 ♥ 0
2.4k Views 2 users read 1 min
support

Hi,

You can use MovePosition to move through the text and select the text while you do that.

var i : Integer;
begin
  // Start of paragraph
  WPRichText1.ActivePosInPar := 0;
  // Select 5 words
  for i:=1 to 5 do
  WPRichText1.MovePosition( wpmWRight, true );
end;

Regards,
Julian

#2 ♥ 0
This category is archived. No new posts are possible.