[Lazarus] SynEdit onMouseWell

Martin lazarus at mfriebe.de
Thu Aug 22 20:41:18 CEST 2013


On 22/08/2013 19:36, Martin wrote:
> On 22/08/2013 17:20, Junior wrote:
>> Hello all.
>>
>> How to implement onMouseWell in SynEdit ?
>
>
> looks like a bug

try to change it to the below. (int synedit.pp


I have not tested it yet... will do later

procedure TCustomSynEdit.WMMouseWheel(var Message: TLMMouseEvent);
var
   lState: TShiftState;
   MousePos: TPoint;
begin
   if ((sfHorizScrollbarVisible in fStateFlags) and (Message.Y > 
ClientHeight)) or
      ((sfVertScrollbarVisible in fStateFlags) and (Message.X > 
ClientWidth))
    then begin
      inherited;
      exit;
    end;

   MousePos.X := Message.X;
   MousePos.Y := Message.Y;
   if DoMouseWheel(lState, Message.WheelDelta, MousePos) then begin
     Message.Result := 1; // handled
     exit;
   end;

   lState := Message.State - [ssCaps, ssNum, ssScroll]; // Remove 
unreliable states, see http://bugs.freepascal.org/view.php?id=20065

   FMouseClickDoPopUp := False;
   IncPaintLock;
   try
     if Message.WheelDelta > 0 then begin
       FindAndHandleMouseAction(mbXWheelUp, lState, Message.X, 
Message.Y, ccSingle, cdDown, Message.WheelDelta);
     end
     else begin
       // send megative delta
       FindAndHandleMouseAction(mbXWheelDown, lState, Message.X, 
Message.Y, ccSingle, cdDown, Message.WheelDelta);
     end;
   finally
     DecPaintLock;
   end;

   if FMouseClickDoPopUp and (PopupMenu <> nil) then begin
     PopupMenu.PopupComponent:=self;
     PopupMenu.PopUp;
   end;

   Message.Result := 1 // handled, skip further handling by interface
end;





More information about the Lazarus mailing list