TdxBarCustomPopupMenu.OnShow Event
Enables you to perform specific actions before the popup menu appears on screen.
Declaration
property OnShow: TNotifyEvent read; write;
Remarks
At the moment this event is fired, the pop-up position and size of the submenu control associated with the popup menu are already calculated. You can access and adjust them as required, using the popup menu’s SubMenuControl.BoundsRect property.
The following code example shows how to handle the OnShow event to resize the submenu control (widen it and reduce its height to display scroll buttons) and move it to the current mouse position.
uses
..., cxGeometry;
procedure <Form>.<BarPopupMenu>Show(Sender: TObject);
var
ASubMenuControl: TdxBarSubMenuControl;
begin
ASubMenuControl := TdxRibbonPopupMenu(Sender).SubMenuControl;
ASubMenuControl.BoundsRect := cxRectSetOrigin(ASubMenuControl.BoundsRect, Mouse.CursorPos);
ASubMenuControl.BoundsRect := cxRectInflate(ASubMenuControl.BoundsRect, 0, 0, 30, -20);
end;
You can handle the OnPopup event, which fires before the OnShow event, to respond to invoking the popup menu.
See Also