Skip to main content

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

TdxBarCustomPopupMenu.OnShow Event

In This Article

Enables you to perform specific actions before the popup menu appears on screen.

#Declaration

Delphi
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.

Delphi
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