EControl Ltd. Forum Index EControl Ltd.
VCL libraries and software support forum
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

How to keep caret visible?

 
Post new topic   Reply to topic    EControl Ltd. Forum Index -> EControl Syntax Editor
View previous topic :: View next topic  
Author Message
octal



Joined: 05 May 2007
Posts: 7

PostPosted: Sat Nov 10, 2007 2:36 pm    Post subject: How to keep caret visible? Reply with quote

Hi,
How can I keep the caret visible when scrolling text using Ctrl+Up or Ctrl+Down arrow ?

In Delphi (or Visual Studio) when you do Ctrl+Up for example, the text srcolls down but the caret remains visible on last line when the old line containing caret is scrolled out of visible section of text.

Regards
octal
_________________
http://www.pocketmt.com
Back to top
View user's profile Send private message
econtrol
Site Admin


Joined: 09 Jun 2006
Posts: 202

PostPosted: Sat Nov 10, 2007 8:22 pm    Post subject: Reply with quote

Hello,

Behavior of any command may be corrected, for example:


Code:
procedure TEditorFrame.EditorMasterExecuteCommand(Sender: TObject;
  Command: Integer; Data: Pointer; var Handled: Boolean);
var p: TPoint;
begin
  with TCustomSyntaxMemo(Sender) do
    if Command = smTab then
      begin
        Handled := HaveSelection;
        if Handled then
          ExecCommand(smBlockIndent);
      end else
    if Command = smScrollUp then
      begin
        Handled := True;
        ScrollPosY := ScrollPosY - 1;
        p := CaretToMouse(CaretPos.X, CaretPos.Y);
        if p.Y > ClientHeight - DefTextExt.cy then
          CaretPos := MouseToCaret(p.X, ClientHeight - DefTextExt.cy - 3);
      end else
    if Command = smScrollDown then
      begin
        Handled := True;
        ScrollPosY := ScrollPosY + 1;
        p := CaretToMouse(CaretPos.X, CaretPos.Y);
        if p.Y < 0 then
          CaretPos := MouseToCaret(p.X, 3);
      end;
end;


Michael.
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic    EControl Ltd. Forum Index -> EControl Syntax Editor All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group