lcl: TSpeedButton should generate a click event if it changes Down state in spite of csClicked state (fixes issue #0018010)

git-svn-id: trunk@28394 -
This commit is contained in:
paul 2010-11-22 06:15:27 +00:00
parent a2e75a4b8d
commit ec1fc668c9

View File

@ -753,6 +753,7 @@ end;
procedure TCustomSpeedButton.WMLButtonUp(var Message: TLMLButtonUp);
var
OldState: TButtonState;
NeedClick: Boolean;
begin
//DebugLn('TCustomSpeedButton.WMLButtonUp A ',DbgSName(Self),' csCaptureMouse=',DbgS(csCaptureMouse in ControlStyle),' csClicked=',DbgS(csClicked in ControlState));
if (csCaptureMouse in ControlStyle) and (mbLeft in CaptureMouseButtons) then
@ -763,6 +764,8 @@ begin
MouseCapture := False;
end;
NeedClick := False;
if not (csDesigning in ComponentState) and FDragging then
begin
OldState := FState;
@ -778,6 +781,7 @@ begin
if (Message.XPos >= 0) and (Message.XPos < Width) and (Message.YPos >= 0) and (Message.YPos < Height) then
begin
SetDown(not FDown);
NeedClick := True;
end;
end;
@ -791,10 +795,13 @@ begin
begin
//DebugLn('TCustomSpeedButton.WMLButtonUp C');
// Important: Calling Click can invoke modal dialogs, so call this as last
NeedClick := False;
Click;
end;
end;
if NeedClick then
Click;
//DebugLn('TCustomSpeedButton.WMLButtonUp END');
end;