Skip to main content

TdxSkinController.OnPopupSysMenu Event

Enables you to customize the system menu displayed for a skinned form.

Declaration

property OnPopupSysMenu: TdxSkinPopupSysMenuEvent read; write;

Remarks

This event is raised before the system menu is displayed for a form passed as the AForm parameter. Use the ASysMenu parameter to access the system menu and customize its items.

The following code demonstrates how to add custom items to the system menu by handling the OnPopupSysMenu event.

type
  TForm1 = class(TForm)
  // ...
  private
    procedure WMSysCommand(var Msg: TWMSysCommand); message WM_SYSCOMMAND;
  // ...
  end;
implementation
const
  SC_CustomMenuItem = WM_USER + 1;
procedure TForm1.dxSkinController1PopupSysMenu(Sender: TObject; AForm: TCustomForm; ASysMenu: HMENU);
begin
  // Add a separator to the menu
  AppendMenu(ASysMenu, MF_SEPARATOR, 0, '');
  // Add a custom menu item to the menu
  AppendMenu(ASysMenu, MF_STRING, SC_CustomMenuItem, 'Custom Item');
end;
procedure TForm1.WMSysCommand(var Msg : TWMSysCommand);
begin
  if Msg.CmdType = SC_CustomMenuItem then
    // Handle clicks on the custom menu item here
  else
   inherited;
end;
See Also