- Offizieller Beitrag
Zitat1. I notice in the splitscreen demo that if you start writing, the
characters appear simultaneously in the two windows. If you paste a lot of text and then start writing, the other window is not updated until you click in it. Is this correct?
The windows are not connect in a 'hard' way. Both windows use a message loop to process the paint commands "when there is time". Otherwise it would not respond quickly.
If you paste text into one window that will respond before window two does. But window two will be updated when the operation if finished, not if you click into it. Maybe it has to do with the focus since window two will not scroll (for obvious reasons)
Zitat2. Is it possible to move the current position in the first window to the current position in the other window when you move the cursor, click in or scroll the other window (so you always see the same text in both windows)?
WPTools 5 only uses ONE current position. This means the current position in window one is the current position in window two. Also the selections are the same.
When I created this concept I thought about handling different cursor position but that would make the handling much more difficult and UNDO hardly possible. So the UNDOSTACK and the cursor is property of the TWPRTFDataCollection and so shared between the editors.
If you want to scroll the second window according to the first (syncronize both) use Memo.ShowCursor in the OnChangeCursorPos event of the WPRichText 1 and 2. (Do not use the ShowCursor procedure in TWPRichText since that triggers OnChangeCursorPos )
procedure TWPMiniEd.DoChangeCursorPos(Sender: TObject);
begin
if Syncronize1.Checked then
begin
if Sender = WPRichText1 then
WPRichText2.Memo.ShowCursor
else if Sender = WPRichText2 then
WPRichText1.Memo.ShowCursor;
end;
end;
in FormCreate I used:
WPRichText1.OnChangeCursorPos := DoChangeCursorPos;
WPRichText2.OnChangeCursorPos := DoChangeCursorPos;
Alles anzeigen