trichview.com

trichview.support




Re: rv.AddLineBreak ?


Return to index


Author

Message

Mats

Posted: 04/11/2003 14:51:24


Thanks!

Solved the problem by using Checkpoints instead.

By placing a Checkpoint on Both sides of the original paragraph, and allowing

adding of paragraphs between the checkpoints, I can still track "what's going

on".


Many thanks.



"Sergey Tkachenko" <[email protected]> wrote:

>Hi,

>

>This simplest way to do it is by modifying RichView sources: open RVEdit.pas

>and move KeyDown method to the public section of the class declaration.

>

>Now you can write:

>

>procedure TForm3.RichViewEdit1KeyDown(Sender: TObject; var Key: Word;

>  Shift: TShiftState);

>begin

>  if (Key = VK_RETURN) and not (ssShift in Shift) then begin

>    TCustomRichViewEdit(Sender).KeyDown(Key, Shift+[ssShift]);

>    Key := 0;

>  end;

>end;

>

>PS: mixing editing operations with operations introduced in viewer

>(TCustomRichView) like AddNLTag is dangerous for undo/redo buffers.

>Viewer methos should be used on initial stages, after calling Clear and

>before editing.

>

>

>> Hi there.

>>

>> I'm trying to add a LineBreak into a Paragraph when in editing.

>> (RichViewEdit)

>>

>> I don't want the addition of another paragraph when the user hits the

>> Enter-key, instead I want to simulate the Shift-Enter. But I still want

>the

>> user to be able to hit the Enter key to start typing on a new line, but

in

>> the same paragraph. ( I don't want to bother the user with the use of

that

>> shift key)

>>  I have tried the following, in On keyDown;

>>          case Key of

>>                ...

>>                ...

>>               VK_RETURN:

>>                    begin

>>                    Key := 0;

>>                    myitem := rv.CurItemNo; // used to restore cursor pos.

>>                    rv.SetAddParagraphMode(False);

>>                    rv.AddNLTag('',somestyleID,someparagraphID,myTag);

>>                    rv.SetAddParagraphMode(True);

>>                    rv.Format;

>>                    ... some code

>>                    end;

>>               ....

>>

>>

>> But I have problems restoring the cursor possition, etc..

>> Can this be done? Can I send A win_message faking the Shift-Enter key?

>

>

>





Powered by ABC Amber Outlook Express Converter