TMetro

Source: source/classes/tmetro.prg

Standalone class

TMetro creates a full-screen Modern UI (Metro-style) start screen with tiled buttons, inspired by the Windows 8 Metro design language. It displays a background image, a title, current date and time, and a grid of tiled buttons that can be either normal or large (double-width). Each tile has configurable text and background colors and an optional icon image.

Key DATA Members

DATATypeDescription
oWndObjectThe underlying popup window (WS_POPUP style)
cTitleCharacterTitle displayed at the top of the start screen
aButtonsArrayArray of TButtonBmp objects created by AddButton()
nBtnWidthNumericTile width in pixels (default 132)
nBtnHeightNumericTile height in pixels (default 132)
nOriginXNumericStarting X position for tile grid (default 200)
nOriginYNumericStarting Y position for tile grid (default 200)
hBitmapNumericHandle to the background bitmap
oFontObjectSegoe UI Light font for display elements
oFontBObjectSegoe UI Light bold font for time display
oTimerObjectTimer for updating the clock display

Methods

MethodDescription
New( cTitle, nBtnW, nBtnH, cBgFile )Create a new TMetro start screen. cBgFile is a background bitmap file or resource.
Activate()Show the start screen maximized with background, title, date, and time
AddButton( cCaption, nClrText, nClrPane, lLarge, cImg, bAction )Add a tile button with caption, colors, optional image, and action
End()Close the start screen and release resources

Example: Metro Screen with Tiles

#include "FiveWin.ch"

function Main()

   local oMetro

   oMetro := TMetro():New( "My Application", 132, 132, "bg.bmp" )

   oMetro:AddButton( "Customers", CLR_WHITE, CLR_HBLUE, .F., "cust.bmp",;
      { || MsgInfo( "Customers" ) } )

   oMetro:AddButton( "Products", CLR_WHITE, CLR_HGREEN, .F., "prod.bmp",;
      { || MsgInfo( "Products" ) } )

   oMetro:AddButton( "Reports", CLR_WHITE, CLR_HRED, .T., "rpt.bmp",;
      { || MsgInfo( "Reports" ) } )

   oMetro:Activate()

return nil

Notes

See Also