Updated: Dec 16, 2023
Follow on twitter

Additional features in menus

  • The TsSkinManager.OnGetPopupItemData event
  • Headers for groups of menu items
  • Multiline texts in items
  • Additional vertical info bar
  • Global changing of font in menu
  • Customizable alphablending effect
  • Attachment to system menus of forms

Download the demo of menu items customizing

The TsSkinManager.OnGetPopupItemData event

The event occurs before a drawing of popup menu and allow to define a font for an each menu item. Height of items is calculated automatically when size of font is changed.

Parameters:

  • Item - current menu item
  • State - state of the current menu item
  • ItemData - structure which contains requested data, required for a drawing. This structure contains the Font property, adding of more properties is planned.
  • Headers for groups of menu items

    Divider is drawn in standard menu, if Caption = "-". Additional possibility of menu item drawing as header is added in the AlphaControls. Caption should have "-" symbol in the beginning and in the end.

    Multiline texts in items

    Text of menu item is wrapped automatically, if contains a carriage-return + line-feed combination (#13#10).

    Additional vertical info bar

    Showing of additional vertical information lines in popup menus may be enabled in the TsSkinManager.MenuSupport.UseExtraLine property. If this property is enabled then this line will be drawn on all popup menus. Using the OnGetMenuExtraLineData event we can define which menus should have a vertical line. Also, we can define a text and glyph there.

    The TsSkinManager.OnGetMenuExtraLine event is called before drawing of popup menu. Vertical info bar will be shown in current menu if LineVisible property is True. The FirstItem parameter points to the first menu item for this popup menu. Focusing on this option you can enable or disable the extra line, also may be defined such parameters as SkinSection, Caption, and Glyph.

    The TsSkinManager.MenuSupport.ExtraLineFont specifies a font which will be used for a text drawing.

    TsSkinManager.MenuSupport.ExtraLineWidth - width of extra line.

    Global changing of font in menu

    We can define a font which will be used in all popup menus of application.

    Changing of fonts in menus is possible using the TsSkinManager.MenuSupport.Font property. If the TsSkinManager.MenuSupport.CustomFont property is True, then Font used in all skinned menus in application.

    Customizable alphablending effect

    The TsSkinManager.MenuSupport.AlphaBlend property allows to define a popup menus transparency. Menu is fully transparent if value of the property is 0. When value is 255 (default value) - popup menu is not transparent.

    Attachment to the system menu of forms

    The TsSkinProvider component have the SysSubMenu property. We can define there a popup menu which will be attached to the system menu of form.

    Replacement of system shadows

    The TsSkinManager.MenuSupport.SkinnedShadows property replaces system shadows by custom skinned shadows.




    Menu items are handled and skinned automatically usually. If new menu items are added in run-time, then they should be initialized using the HookPopupMenu procedure (after adding).

    Example:

    sSkinManager1.SkinableMenus.HookPopupMenu(PopupMenu1, sSkinManager1.Active);



    Installing, using and licensing the demo programs © Sergii Goncharov, Ukraine, Odessa 2004-2023