Recent

Author Topic: MacOS firing OnMouseWheelDn Twice  (Read 128 times)

josh

  • Hero Member
  • *****
  • Posts: 653
MacOS firing OnMouseWheelDn Twice
« 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
Development Installation Lazarus 1.3, FPC 2.7.1,Windows 7/8 32/64, OSX, *nix

Test Environment Lazarus & FPC Trunk on Windows and OSX (Cocoa Mainly on OSX). Testing also Crosscompile windows to OSX.. 
Any posts made from 2015 will be based on Lazarus Trunk.

josh

  • Hero Member
  • *****
  • Posts: 653
Re: MacOS firing OnMouseWheelDn Twice
« Reply #1 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}   
Development Installation Lazarus 1.3, FPC 2.7.1,Windows 7/8 32/64, OSX, *nix

Test Environment Lazarus & FPC Trunk on Windows and OSX (Cocoa Mainly on OSX). Testing also Crosscompile windows to OSX.. 
Any posts made from 2015 will be based on Lazarus Trunk.