TMlSkinCountBar

A pager bar showing page numbers with previous and next buttons, for paged browsing.

Category
Lists & combo boxes
Unit
uMlSkinCountBar.pas
Inherits from
TMlSkinCustomCountBarTMlSkinCustomIconButtonListTMlSkinCustomPanelTMlSkinCustomControl

Notes

  • NumCount is the total number of pages; the previous and next buttons fire OnPreviousClick and OnNextClick.
  • OnNumChanged fires when the page changes — that is where you load the data for the new page.
  • Kinds decides which parts are shown: page numbers, prev/next buttons, a jump box and so on.
  • Normal pages and the current page are styled separately through ColorNormal, ColorFocus and FontFocus.

Example

From the demo MlSkin.Demo.翻页栏+透明背景ListBox.v.3.0 (.dfm form file)

object mlcb1: TMlSkinCountBar
  Left = 1
  Top = 428
  Width = 591
  Height = 34
  Color = 16185078
  FontFocus.Charset = DEFAULT_CHARSET
  FontFocus.Color = clWhite
  FontFocus.Height = -13
  FontFocus.Name = 'Tahoma'
  FontFocus.Style = []
  ColorNormal = clWhite
  OnSkipClick = mlcb1SkipClick
  OnNumChanged = mlcb1NumChanged
  Font.Charset = DEFAULT_CHARSET
  Font.Color = clWindowText
  Font.Height = -13
  Font.Name = 'Tahoma'
  Font.Style = []
  Alpha = 196

Properties 20

NameTypeDefaultDescription
AlignWithItemsTMlItemHAlignihaLeftHorizontal alignment of the items inside the control: ihaLeft, ihaCenter or ihaRight.
AlignVerticalWithItemsTMlItemVAlignihavTopVertical alignment of the items inside the control: top, centre or bottom.
CaptionVisibleBooleanTrueWhether the caption is drawn. Turn it off for icon-only buttons.
ItemWidthIntegerWidth of each item in pixels.
ItemHeightIntegerHeight of each item in pixels.
ItemSpaceSizeInteger10Gap between items in pixels.
MarginBorderSizeInteger10Padding between the content and the control edge, in pixels.
KindsTCountKindsWhich parts of the pager are shown — page numbers, previous/next buttons, a jump box — in any combination.
NumCountCardinal5Total number of pages.
FontFocusTFontFont of the current page number.
ColorNormalTColor$00EEEEEEBackground colour of the normal page numbers.
ColorFocusTColor$004966FEBackground colour of the current page number.
AlphaByte192Opacity: 0 fully transparent, 255 opaque.
BorderSidesTSidesWhich border edges are drawn — any combination of top, bottom, left and right.
BorderColorTColor$00D9CBBABorder color.
ColorTColorclWhiteBackground color of the control; ignored while Transparent is on.
BackgroundImageTMlResIDBackground image, given as a resource ID or an image file path.
BackgroundOffsetXInteger0Horizontal offset of the background image in pixels.
BackgroundOffsetYInteger0Vertical offset of the background image in pixels.
DoubleBorderBooleanTrueDouble border: draws a second line inside the border.

Events 8

NameTypeDefaultDescription
OnDrawItemTMlIconButtonItemDrawEnventFires while an item is drawn, so you can style it yourself.
OnGetCursorTMlGetCursorEventFires while the cursor is chosen, so different areas can use different cursors.
OnHotChangedTItemHotFires when the item under the mouse changes.
OnFocusChangingTStateChangeFires just before the focused item changes.
OnNextClickTNotifyEventFires when the next-page button is clicked.
OnPreviousClickTNotifyEventFires when the previous-page button is clicked.
OnSkipClickTNotifyEventFires when the user jumps to a page with the jump box.
OnNumChangedTNotifyEventFires after the current page changes — load that page's data here.
Events of TMlSkinCustomPanel 1
NameTypeDefaultDescription
OnCustomDrawTMlCustomDrawEventCustom draw event: paint your own content after the control has drawn itself.
Properties of TMlSkinCustomControl 4
NameTypeDefaultDescription
AboutTMlAboutInfoA design-time property: double-clicking it in the Object Inspector opens the MLSkin about box with the component version. It has no effect at run time and is not stored in the .dfm.
TransparentBooleanTrueTransparent background: the control skips its own fill and shows the form background (image or color) instead.
AutoInvalidateBooleanFalseRepaints automatically when the content changes. Turn it on if property changes do not show up.
EraseBackgroundBooleanFalseWhether the background is erased before painting; worth toggling if the control flickers.
Events of TMlSkinCustomControl 4
NameTypeDefaultDescription
OnDPIChangedTMlDPIChangedEventFires when the screen DPI changes, for example when the window moves to a monitor with a different scaling — a good place to re-adjust anything you draw yourself.
OnBackgroundChangingTMlBackgroundEventFires just before the background changes, giving you a chance to adjust what is drawn.
OnBackgroundChangedTMlCustomDrawEventFires after the background has been drawn, so you can paint on top of it.
OnVisibleChangedTNotifyEventFires when the control is shown or hidden.

Only the properties and events MLSkin adds are listed here. Standard VCL properties such as Align, Anchors, Font and OnClick are available too and behave exactly as on the stock controls.

Offline helpA PDF / CHM version is available for offline reading.