Forum > macOS / Mac OS X
[SOLVED] TButton.OnMouseUp does not trigger
ling:
I bind an event to OnMouseUp for TButton, but when the button be clicked, only OnMouseDown and OnClick be triggered, is it a bug?
Lazarus version: 2.0.6
FPC: 3.0.4
macOS Catalina 10.15.7
lucamar:
If you have properly set up events then yes, it looks like a bug, though it might be OS-specific behaviour; I don't know enough about Macos to even guess.
The "normal" chain of events is:
* MouseDown,
* MouseUp,
* Click
Handoko:
It works on my Ubuntu Mate 20.10 Lazarus 2.0.10 GTK2.
I wrote a very simple demo to test it. Download and run my code, if it does not work on your computer, please report it to the bugtracker: https://bugs.freepascal.org/view_all_bug_page.php?project_id=1
--- Code: Pascal [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---unit Unit1; {$mode objfpc}{$H+} interface uses Classes, SysUtils, Forms, Controls, Graphics, Dialogs, StdCtrls; type { TForm1 } TForm1 = class(TForm) Button1: TButton; procedure Button1MouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); procedure Button1MouseUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); end; var Form1: TForm1; implementation {$R *.lfm} { TForm1 } procedure TForm1.Button1MouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);begin Button1.Caption := 'MouseDown event triggered';end; procedure TForm1.Button1MouseUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);begin Button1.Caption := 'MouseUp event triggered';end; end.
ling:
@Handoko Thanks for your demo code. I've tried it, mouse up doesn't trigger.
trev:
It works in macOS 10.14 with Lazarus trunk and FPC 3.0.4 or 3.2.0 or trunk.
Looks like it was fixed in Lazarus 2.0.8 - the OP needs to upgrade! See Bug #38099.
I just confirmed that it works in Lazarus 2.0.10 with FPC 3.2.0.
Navigation
[0] Message Index
[#] Next page