← Back to Index

TFlexFMXPopup

Flexible popup/overlay component for menus, tooltips, popovers, and modal content.

Key Properties

PopupType: TPopupType
Type: ptDropdown, ptModal, ptTooltip, ptPopover.
PlacementTarget: TControl
Control to position popup relative to.
Placement: TPlacement
Position: pTop, pBottom, pLeft, pRight, pCenter.
ShowBackdrop: Boolean
Display semi-transparent backdrop behind popup.
BackdropColor: TAlphaColor
Backdrop overlay color.
CloseOnBackdropClick: Boolean
Dismiss popup when clicking backdrop.
ShowArrow: Boolean
Display arrow/pointer to target control.
AnimationType: TPopupAnimation
Entry/exit animation: paSlide, paFade, paZoom, paNone.
AnimationDuration: Single
Animation duration in seconds.
AutoSize: Boolean
Automatically size popup to fit content.

Usage Examples

Dropdown Menu

Popup1.PopupType := ptDropdown;
Popup1.PlacementTarget := Button1;
Popup1.Placement := pBottom;
Popup1.ShowArrow := True;
Popup1.CloseOnBackdropClick := True;

// Add menu items to popup
var MenuLayout := TFlexFMXLayout.Create(Popup1);
MenuLayout.Parent := Popup1;
// Add menu buttons...

Popup1.Popup; // Show popup

Modal Dialog

Popup1.PopupType := ptModal;
Popup1.Placement := pCenter;
Popup1.ShowBackdrop := True;
Popup1.BackdropColor := $80000000; // 50% black
Popup1.CloseOnBackdropClick := True;
Popup1.AnimationType := paZoom;

Popup1.Width := 400;
Popup1.Height := 300;
Popup1.Popup;

Tooltip

Popup1.PopupType := ptTooltip;
Popup1.PlacementTarget := EditControl;
Popup1.Placement := pTop;
Popup1.ShowArrow := True;
Popup1.AnimationType := paFade;

var Label := TLabel.Create(Popup1);
Label.Parent := Popup1;
Label.Text := 'Enter your email address';
Label.TextSettings.Font.Size := 12;

Popup1.AutoSize := True;
Popup1.Popup;

Context Menu

procedure TForm1.Image1MouseDown(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Single);
begin
  if Button = TMouseButton.mbRight then
  begin
    Popup1.PopupType := ptDropdown;
    Popup1.PlacementTarget := Image1;
    Popup1.Placement := pBottom;
    // Position at cursor
    Popup1.Left := X;
    Popup1.Top := Y;
    Popup1.Popup;
  end;
end;

Methods

Events

Notes

← Back to Index