press a line 2 spaces to the right (or left)

General TRichView support forum. Please post your questions here
Post Reply
j&b
Posts: 182
Joined: Mon Sep 05, 2005 1:35 pm

press a line 2 spaces to the right (or left)

Post by j&b »

In Delphi editor I find it quite pleasant to press the (highlighted) line 2 spaces to the right (Ctrl+k i ) and 2 spaces to

the left (Ctrl+k u).

I have both implemented for TRichViewEdit about ctrl+spacebar and shift+spacebar.

When I move the (unmarked) line 2 places to the left (cursor stands at the beginning of a memoline - using shift+spacebar)

it bothers me that I can see that a space is inserted before line is going 2 spaces to the left.

I can't prevent that space character is being inserted. I have tried many things (key: = 0 - KeyPreview:= true -

form1.keyUp ...).

Does anyone know a solution that I can't see that a space is inserted before line is going 2 spaces to the left) ?


memo: TRichViewEdit;
memo.Options.rvoShowSpecialCharacters:= true; //damit man die Leerzeichen sieht


procedure TForm1.memoKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
var memopos: integer;
begin
if (ssCtrl in Shift) and (key= 32) then begin
try
LockWindowUpdate(form1.Handle); //#32 wird 2x eingefügt:
memoPos:=RVGetLinearCaretPos(memo); //1. durch key= 32 und
memo.InsertText(#32); //2. durch memo.InsertText
Application.ProcessMessages; //MUSS sein
memo.selectCurrentword;
RVSetLinearCaretPos(memo,memopos); //Cursor wieder an Ausgangsposition
finally
LockWindowUpdate(0);
end;
end;
end;

procedure TForm1.memoKeyUp(Sender: TObject; var Key: Word; Shift: TShiftState);
begin
if (ssShift in Shift) and (key= 32) then begin
try //1 Space wurde zuvor durch
memoPos:=RVGetLinearCaretPos(memo)-1; //key= 32 eingefügt - egal was ich

ausprobiert habe
LockWindowUpdate(form1.Handle);
RVSetSelection(memo,memopos, 3);
if memo.GetSelText= #32#32#32 then RVSetSelection(memo,memopos, 3) //eingefügtes + 2 weitere Leerzeichen
else if pos(#32#32,memo.GetSelText)= 1 then RVSetSelection(memo,memopos, 2)
else if pos(#32,memo.GetSelText)= 1 then RVSetSelection(memo,memopos, 1)
else exit;
Application.ProcessMessages; //MUSS sein
memo.deleteSelection;
RVSetLinearCaretPos(memo,memoPos);
finally
LockWindowUpdate(0);
end;
end;
end;
j&b
Posts: 182
Joined: Mon Sep 05, 2005 1:35 pm

Post by j&b »

No one an idea how how to prevent the insertion of a space (in memo.keyUp) ?


Hello Sergey,

if I click 'Preview' in Editor for this post, I can't find a preview where I can change text
Sergey Tkachenko
Site Admin
Posts: 17253
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

Space insertion can be blocked only in OnKeyPress (by assigning#0 to the parameter).
j&b
Posts: 182
Joined: Mon Sep 05, 2005 1:35 pm

Post by j&b »

Thank you for your hint.


Why can't I see this text in the topic review if I click 'Preview'.
How can I see if changed text (colors etc.) is correct ?
j&b
Posts: 182
Joined: Mon Sep 05, 2005 1:35 pm

Post by j&b »

j&b wrote:Thank you for your hint.


Why can't I see this text in the topic review if I click 'Preview'.
How can I see if changed text (colors etc.) is correct ?
xxxx
Sergey Tkachenko
Site Admin
Posts: 17253
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

Why can't I see this text in the topic review if I click 'Preview'.
How can I see if changed text (colors etc.) is correct ?
Sorry, I do not understand
j&b
Posts: 182
Joined: Mon Sep 05, 2005 1:35 pm

Post by j&b »

After I wrote a topic, I had the option to press button 'PREVIEW' or to press 'SUBMIT').
A few years ago I was able to change my text in the 'Preview', set font attributes etc. When I was satisfied, I submit the text.
This is now not possible. When I click 'Preview', I only get the topics which are submitted.
Where can I find a help - if possible in German - to write and to change topics BEFORE I submit the text (I have seen the hint that I can't edit topics - I refer it to SUBMITTED topics)
Sergey Tkachenko
Site Admin
Posts: 17253
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

On my computer, the forum's Preview works as expected. I use Internet Explorer 11.
j&b
Posts: 182
Joined: Mon Sep 05, 2005 1:35 pm

Post by j&b »

Hallo Sergey

You are right. Sorry. ALL OK.&nbsp &#160 :roll:

I searched the preview under the buttons 'Preview' and 'Submit'

How can I press the emoticon 2 (or more spaces to right - i know &nbsp or &#160. But these shortcuts doesn't work).

I tested this text with Chrome and Internet Explorer 9. All ok
Post Reply