function TCustomThumbView.IsMenuKey(var Message: TWMKey): Boolean;
var
LocalPopupMenu: TPopupMenu;
begin
Result := True;
if not (csDesigning in ComponentState) then
begin
LocalPopupMenu := FAutoContextMenu;
if Assigned(LocalPopupMenu) and (LocalPopupMenu.WindowHandle <> 0) and
LocalPopupMenu.IsShortCut(Message) then Exit;
end;
Result := False;
end;
procedure TCustomThumbView.CNKeyDown(var Message: TWMKeyDown);
begin
with Message do
begin
Result := 1;
UpdateUIState(Message.CharCode);
if FAutoContextMenu.AutoPopup and IsMenuKey(Message) then Exit;
end;
inherited;
end;
procedure TCustomThumbView.CNSysKeyDown(var Message: TWMKeyDown);
begin
with Message do
begin
Result := 1;
if FAutoContextMenu.AutoPopup and IsMenuKey(Message) then Exit;
end;
inherited;
end;
procedure TCustomThumbView.DoContextPopup(MousePos: TPoint;
var Handled: Boolean);
begin
if FAutoContextMenu.AutoPopup then
begin
MousePos := ClientToScreen(MousePos);
FAutoContextMenu.Popup(MousePos.X, MousePos.Y);
Handled := True;
end
else inherited;
end;