diff options
author | Graeme Geldenhuys <graeme@mastermaths.co.za> | 2011-01-19 21:47:15 +0200 |
---|---|---|
committer | Graeme Geldenhuys <graeme@mastermaths.co.za> | 2011-01-19 21:47:15 +0200 |
commit | 9fd8c8491a9b1662e288e34058cb58f942f55a32 (patch) | |
tree | b3bb74d3a3928e1f3e5232697b7dd0e4b73d7a5c /src | |
parent | cb6b49095c44aa6be4307d3d6b5320575256792a (diff) | |
download | fpGUI-9fd8c8491a9b1662e288e34058cb58f942f55a32.tar.xz |
OnClick now only triggers if the LeftMouseUp occurs in the bounds of the widget.
Old behaviour was that the OnClick will trigger even if the left
mouse button was released outside the bounds. This is not standard
behaviour compared to other gui toolkits.
Diffstat (limited to 'src')
-rw-r--r-- | src/corelib/fpg_widget.pas | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/corelib/fpg_widget.pas b/src/corelib/fpg_widget.pas index beb0fbe1..ff9dec72 100644 --- a/src/corelib/fpg_widget.pas +++ b/src/corelib/fpg_widget.pas @@ -1051,9 +1051,15 @@ begin end; procedure TfpgWidget.HandleLMouseUp(x, y: integer; shiftstate: TShiftState); +var + r: TfpgRect; begin - if FOnClickPending and Assigned(FOnClick) then + r.SetRect(0, 0, Width, Height); + if PtInRect(r, Point(x, y)) and FOnClickPending then + begin + if Assigned(FOnClick) then FOnClick(self); + end; end; procedure TfpgWidget.HandleRMouseUp(x, y: integer; shiftstate: TShiftState); |