Beiträge von toreo

    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?

    I would imagine that setting wpAutoDetectHyperlinks in EditOptions to true would be sufficient to convert anything starting with www to a hyperlink, but that does not happen when I build a small demo project. Am I missing something?

    v. 6.03, D2007.

    You are right. When I tested if the event occurred, I used an image containing a hyperlink. But my original question remains: Why doesn't the code work? The image is still pasted as a character. Similar code works when loading the image from a file.

    Do you have suggestions for my other problems?

    1. How can I set the wrap and positionmode of an image that is pasted from the cliboard? I tried

    procedure TChildForm.EditorBeforePasteImage(Sender: TObject;
    RTFData: TWPRTFDataCollection; var TxtObj: TWPObject);
    begin
    TWPTextObj(txtobj).Wrap := wpwrAutomatic;
    TWPTextObj(txtobj).PositionMode := wpotPar;
    end;

    but that doesn't seem to work.

    2. When I copy an image with a hyperlink from the web, both the image and the link is pasted. How can I avoid pasting the link?

    3. When I try to resize an image with an embedded hyperlink, the link is activated when the resizing is finished. Is it possible to avoid that?

    4. Is it possible to position an image so that there is no text on the sides, just above and below?

    In any program you may use the GetKeyState API function:

    if HiWord(GetKeyState(vk_Insert)) <> 0 then
    ShowMessage('Insert')
    else
    ShowMessage('Overwrite') ;

    The pressing of the Ins key can be caught when the program is idle:

    private
    procedure CheckKey(Sender: TObject; var Done: Boolean);

    procedure TForm1.FormCreate(Sender: TObject);
    begin
    Application.OnIdle := CheckKey;
    end;

    procedure TForm1.FormDestroy(Sender: TObject);
    begin
    Application.OnIdle := nil
    end;

    procedure TForm1.CheckKey(Sender: TObject; var Done: Boolean);
    begin
    if HiWord(GetKeyState(vk_Insert)) <> 0 then
    //whatever
    end;

    With the following code there is an AV if two or more cells in a table are selected:

    ConvertMode := wpUppercase; //(also AV with wpLowercase)
    WpRichText1.TextCursor.CallForSelectedText(Self, [], nil, nil, CharCallback, nil);
    WpRichText1.DelayedReformat;

    Will this be repaired in the next update?

    This is the second reference to v 6 I have seen in this forum and is exciting news. Could you describe the major new features planned for this release, and when it perhaps will be available?

    By the way, OLE objects would be much welcome.

    I agree that this combination does not make much sense and combined with a table it will occur very rarely, but when it is available it should work 100 percent. Perhaps the cause of this small glitch will surface in other circumstances too?

    Use the wplayNormal layout and autozoom = wpAutoZoomFullPage. Then start a new document with a one line headline and hit enter twice. Then insert a table. Continue writing below the table so that the text starts to fill most of the page. Then the headline disappears, and if you try to edit the headline, what you write is invisible. If you change the zoom or the layoutmode, the (modified) headline reappears.

    Julian, can you reproduce this?

    I did both place a breakpoint and a showmessage at the very start of the Compress procedure, and it was never called after pasting an image.

    And, an image copied from a web page, IS a bitmap, isn't it?