Skip to main content

TdxBarCustomPopupMenu.PopupEx(Integer,Integer,Integer,Integer,Boolean,PRect,Boolean,TWinControl) Method

Displays the popup menu on screen.

Declaration

procedure PopupEx(X: Integer; Y: Integer; AOwnerWidth: Integer; AOwnerHeight: Integer; AShowAnimation: Boolean; AOwnerBounds: PRect; AUseOwnMessageLoop: Boolean = True; AOwnerControl: TWinControl = nil);

Parameters

Name Type
X Integer
Y Integer
AOwnerWidth Integer
AOwnerHeight Integer
AShowAnimation Boolean
AOwnerBounds PRect
AUseOwnMessageLoop Boolean
AOwnerControl TWinControl

Remarks

The PopupEx method is an extended version of the Popup method, which is called internally. The PopupEx method displays the popup menu at the pop-up position specified by the X and Y absolute coordinates. The AOwnerWidth and AOwnerHeight parameters are used if the popup menu doesn’t fit into the desktop. By default (if these parameters are set to 0 or the Popup method is called), the popup menu will be shifted onscreen so it can be completely displayed. In some cases however, you may need the popup menu to not overlap the control it is displayed for (this behavior is typical for dropdown buttons). In this instance, you should use the AOwnerWidth and AOwnerHeight parameters to specify the width and height of the rectangle that shouldn’t be overlapped. The X and Y parameters specify the rectangle’s bottom-right corner.

Note that passing 0 as the AOwnerWidth parameter and a positive integer as the AOwnerHeight parameter creates a horizontal band that will not be overlapped. The Y parameter specifies the band’s bottom coordinate while the AOwnerHeight parameter is the band’s height. Passing 0 as the AOwnerHeight parameter and a positive integer as the AOwnerWidth parameter creates a vertical band that will not be overlapped.

You may prevent animation effects when displaying a popup window by setting the AShowAnimation parameter to False. By default, the animation is specified by the bar manager’s MenuAnimations property.

Lastly, the AOwnerBounds property enables you to display a shadow around the control for which the menu was invoked. You should pass the control’s bounding rectangle in screen coordinates for this purpose. This imitates the behavior of menus in Microsoft Office 10 (a main menu’s item whose sub-menu is invoked is raised by painting a shadow under it). Note however, that one of the popup menu’s edges must match a control’s edge. Otherwise, the shadow will not be displayed.

Use the PopupAlignment property to specify how the popup menu is horizontally aligned relative to the pop-up position passed as the X and Y parameters.

See Also