Lazarus
Programming => Operating Systems => macOS / Mac OS X => Topic started by: teriyaki on January 22, 2022, 05:24:09 pm
Title:
bitbtn.OnMouseEnter does not work on macOS
Post by:
teriyaki
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]
[+]
[-]
MouseEntered deprecated
/
missing
Old behavior
:
No warning on using MouseEntered
New
behavior
:
Warning
:
Symbol "MouseEntered" is deprecated
:
"use MouseInClient instead"
Reason
:
Delphi compatibility
Remedy
:
use
property
MouseInClient instead
but there is no onMouseInClient function for TBitBtn
your comment welcome
Title:
Re: bitbtn.OnMouseEnter does not work on macOS
Post by:
winni
on
January 22, 2022, 06:14:16 pm
Hi!
Use this:
Code: Pascal
[Select]
[+]
[-]
procedure
TForm1
.
BitBtn7MouseMove
(
Sender
:
TObject
;
Shift
:
TShiftState
;
X
,
Y
:
Integer
)
;
begin
if
BitBtn7
.
MouseInClient
then
ShowMessage
(
'MouseTrap'
)
;
end
;
Winni
Title:
Re: bitbtn.OnMouseEnter does not work on macOS
Post by:
teriyaki
on
January 23, 2022, 10:03:07 am
Code: Pascal
[Select]
[+]
[-]
procedure
TmainForm
.
BitBtn1MouseMove
(
Sender
:
TObject
;
Shift
:
TShiftState
;
X
,
Y
:
Integer
)
;
begin
if
BitBtn1
.
MouseInClient
then
//here can be triggered
begin
ShowMessage
(
'MouseTrap'
)
;
//here can NOT be triggered
end
;
Title:
Re: bitbtn.OnMouseEnter does not work on macOS
Post by:
winni
on
January 23, 2022, 11:56:46 am
Hi!
MouseInClient is inheritated from Tcontrol!
To make it more clear use this:
Code: Pascal
[Select]
[+]
[-]
var
Global_I
:
Integer
=
1
;
...
procedure
TmainForm
.
BitBtn1MouseMove
(
Sender
:
TObject
;
Shift
:
TShiftState
;
X
,
Y
:
Integer
)
;
begin
if
BitBtn1
.
MouseInClient
then
//here can be triggered
begin
inc
(
Global_I
)
;
BitBtn1
.
Caption
:
=
'MouseInClient '
+
IntToStr
(
Global_I
)
;
end
;
Winni
TinyPortal
© 2005-2018