Recent

Author Topic: bitbtn.OnMouseEnter does not work on macOS  (Read 2048 times)

teriyaki

  • New Member
  • *
  • Posts: 47
bitbtn.OnMouseEnter does not work on macOS
« on: January 22, 2022, 05:24:09 pm »
I can set the function, but OnMouseEnter is never triggered

 %)

I checked at
https://wiki.freepascal.org/Lazarus_2.0.0_release_notes

and found out that
Code: Pascal  [Select][+][-]
  1. MouseEntered deprecated/missing
  2. Old behavior: No warning on using MouseEntered
  3. New behavior: Warning: Symbol "MouseEntered" is deprecated: "use MouseInClient instead"
  4. Reason: Delphi compatibility
  5. Remedy: use property MouseInClient instead

but there is no onMouseInClient function for TBitBtn

your comment welcome

winni

  • Hero Member
  • *****
  • Posts: 3197
Re: bitbtn.OnMouseEnter does not work on macOS
« Reply #1 on: January 22, 2022, 06:14:16 pm »
Hi!

Use this:

Code: Pascal  [Select][+][-]
  1. procedure TForm1.BitBtn7MouseMove(Sender: TObject; Shift: TShiftState; X,
  2.                 Y: Integer);
  3. begin
  4.   if BitBtn7.MouseInClient then ShowMessage('MouseTrap');
  5. end;
  6.  

Winni

teriyaki

  • New Member
  • *
  • Posts: 47
Re: bitbtn.OnMouseEnter does not work on macOS
« Reply #2 on: January 23, 2022, 10:03:07 am »
Code: Pascal  [Select][+][-]
  1. procedure TmainForm.BitBtn1MouseMove(Sender: TObject; Shift: TShiftState; X,
  2.   Y: Integer);
  3. begin
  4.  
  5.    if BitBtn1.MouseInClient then //here can be triggered
  6.    begin
  7.       ShowMessage('MouseTrap');//here can NOT be triggered
  8.    end;
   

winni

  • Hero Member
  • *****
  • Posts: 3197
Re: bitbtn.OnMouseEnter does not work on macOS
« Reply #3 on: January 23, 2022, 11:56:46 am »
Hi!

MouseInClient is inheritated from Tcontrol!

To make it more clear use this:

Code: Pascal  [Select][+][-]
  1. var Global_I : Integer = 1;
  2. ...
  3. procedure TmainForm.BitBtn1MouseMove(Sender: TObject; Shift: TShiftState; X,
  4.       Y: Integer);
  5.     begin
  6.      
  7.        if BitBtn1.MouseInClient then //here can be triggered
  8.        begin
  9.        inc(Global_I);
  10.        BitBtn1.Caption := 'MouseInClient '+IntToStr(Global_I);
  11.        end;
  12.  
  13.  

Winni

 

TinyPortal © 2005-2018