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 

Change RightMargin behaviour

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



Joined: 27 Jul 2009
Posts: 8

PostPosted: Tue Jul 28, 2009 5:59 pm    Post subject: Change RightMargin behaviour Reply with quote

I need to changes in RightMargin behaviour:

1. Smooth moving (one pixel step, not char width).
2. Drag'n'drop with simple click, without Ctrl pressing.

Is it possible?
Back to top
View user's profile Send private message
Stringer



Joined: 27 Jul 2009
Posts: 8

PostPosted: Wed Jul 29, 2009 1:50 pm    Post subject: Reply with quote

I have found a solution of both issues in a little bit editing of ecSyntMemo source. But I guess this is an incorrect way.
Back to top
View user's profile Send private message
econtrol
Site Admin


Joined: 09 Jun 2006
Posts: 202

PostPosted: Thu Jul 30, 2009 6:13 am    Post subject: Reply with quote

Hello,

If you get required behavior, please, send me updated source to integrate into working version.

Michael.
Back to top
View user's profile Send private message Send e-mail
Stringer



Joined: 27 Jul 2009
Posts: 8

PostPosted: Thu Jul 30, 2009 10:21 am    Post subject: Reply with quote

1.
Code:

function TCustomSyntaxMemo.DefTextExt: TSize;
<...>
  if Result.cx = 0 then
    raise Exception.Create('Internal error: DefTextExt.cx = 0');
{$IFDEF DL_MOD_SMOOTH_RIGHTMARGIN}
      Result.cx := 1;
{$ENDIF}
end;

2.
Code:

procedure TCustomSyntaxMemo.MouseDown(Button: TMouseButton;
<...>
      if ssCtrl in Shift then
       begin
        FDragStaple := IsOverStaple(X, Y);
        if FDragStaple <> nil then  Exit;
{$IFDEF DL_MOD_DRAG_RIGHTMARGIN_NON_CTRL}
       end;
{$ENDIF}
        FDraggedTextMargin := IsOverRightMargin(X);
        if Assigned(FDraggedTextMargin) then
          if FDraggedTextMargin.AllowDrag then
            Exit
          else
            FDraggedTextMargin := nil;
{$IFNDEF DL_MOD_DRAG_RIGHTMARGIN_NON_CTRL}
       end;
{$ENDIF}

<...>
end;

Code:

procedure TCustomSyntaxMemo.MouseMove(Shift: TShiftState; X, Y: Integer);
<...>

  function CanDragMargin: Boolean;
  begin
    tm := IsOverRightMargin(X);
{$IFDEF DL_MOD_DRAG_RIGHTMARGIN_NON_CTRL}
    Result := Assigned(tm) and tm.AllowDrag;
{$ELSE}
    Result := Assigned(tm) and tm.AllowDrag and (ssCtrl in Shift);
{$ENDIF}
  end;

<...>

All works
Back to top
View user's profile Send private message
econtrol
Site Admin


Joined: 09 Jun 2006
Posts: 202

PostPosted: Thu Jul 30, 2009 12:13 pm    Post subject: Reply with quote

This implementation is not good, because changing DefTextExt will effect on many other items.

Text margins processing was updated. New properties available:

Code:
TecTextMargins:
    property AbsolutePos: Boolean; // Position of text margin - absolute
    property AllowDrag: Boolean; // when true -dragging defined by individual allow drag
    property DragWithCtrl: Boolean; // Drag with pressed control (or without it)


To access these properties from IDE updated collection editor property added, so these properties can be edited in object inspector.
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