Lazarus

Programming => Operating Systems => macOS / Mac OS X => Topic started by: Josh on December 07, 2018, 03:38:44 pm

Title: MacOS firing OnMouseWheelDn Twice
Post by: Josh on December 07, 2018, 03:38:44 pm
Hi

I have various controls that support the mouse wheel, but on MacOS Carbon, the event is fired twice.
unfortunately I do not have a working cocoa to test if it also in there tooo.

Place a control that supports onmousewheeldown, set the event to showmessage('hi'); then run and move the scroll wheel, it fires twice.

Can anyone cofirm?

Laz 2.1.0, FPC 3.2  i386-darwin-carbon
Title: Re: MacOS firing OnMouseWheelDn Twice
Post by: Josh on December 08, 2018, 11:19:12 am
I added the the following code to the wheelevents of the controls to ignore a rapid second fire

Code: [Select]

// notes  mac_stop_double_fire is a cardinal global varible
//            mac_stop_double_fire_limit  is a const i set at 12     

{$ifdef darwin}
  if datetimetotimestamp(now).time-mac_stop_double_fire<mac_stop_double_fire_limit then exit;
  mac_stop_double_fire:=datetimetotimestamp(now).time;
  {$endif}   
TinyPortal © 2005-2018