WPCubed Product Support

Synchronizing cursor position in RTF text

I try to have the text spoken by the SAPI 5.3 component TSPVoice. I feed the component with WPRichText.AsAnsiString('ANSI') and it speaks. I then want the spoken word to be highlighted and use the component's OnWord event like this:

procedure TForm1.SPVoiceWord(ASender: TObject; StreamNumber: Integer; StreamPosition: OleVariant; CharacterPosition, Length: Integer);
begin
with WPRichText do
begin
SelStart := CharacterPosition;
SelLength := Length;
// or alternatively SelectWord;
end;
end;

The problem is after a word contains a bookmark or a hyperlink, CharacterPosition is no longer equal to the cursor position; the cursor lags behind.

Any ideas on how I can solve this problem?

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

Hi,

I put in a funvtion for this in next release:
ConvertIntoCPPosition

Julian

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