procedure TControl.WMContextMenu(var Message: TWMContextMenu);
var
Pt, Temp: TPoint;
Handled: Boolean;
PopupMenu: TPopupMenu;
begin
if Message.Result <> 0 then Exit;
if csDesigning in ComponentState then
begin
inherited;
Exit;
end;
Pt := SmallPointToPoint(Message.Pos);
if InvalidPoint(Pt) then
Temp := Pt
else
begin
Temp := ScreenToClient(Pt);
if not PtInRect(ClientRect, Temp) then
begin
inherited;
Exit;
end;
end;
Handled := False;
DoContextPopup(Temp, Handled);
Message.Result := Ord(Handled);
if Handled then Exit;
If GetKeyState(VK_MENU) < 0 then exit; {V}
PopupMenu := GetPopupMenu;
if (PopupMenu <> nil) and PopupMenu.AutoPopup then
begin
SendCancelMode(nil);
PopupMenu.PopupComponent := Self;
if InvalidPoint(Pt) then
Pt := ClientToScreen(Point(0, 0));
PopupMenu.Popup(Pt.X, Pt.Y);
Message.Result := 1;
end;
if Message.Result = 0 then
inherited;
end;
Комментариев нет:
Отправить комментарий