TSliderMetro
Fonte: source/classes/sliderm.prg
Not inherited from TControl (standalone class)
TSliderMetro implements a slide-to-unlock screen in the style of Windows Metro / Modern UI. It displays a full-screen bitmap overlay with "FiveWin touch" and "Slide to unlock" text, and responds to vertical drag gestures. Dragging the bitmap upward reveals the underlying window. It is designed for touch-enabled kiosk or tablet applications.
Key DATA Members
| DATA | Type | Description |
|---|---|---|
oBmp | Object | TBitmap instance holding the full-screen background image |
oFont1 | Object | Large font ("Segoe UI Light" 90pt bold) for the title text |
oFont2 | Object | Medium font ("Segoe UI Light" 60pt bold) for the instruction text |
lDrag | Logical | Indicates a drag operation is in progress |
Methods
| Method | Description |
|---|---|
New( cBmpFile, oWnd ) | Create a slide-to-unlock overlay. Loads the background bitmap and creates the title fonts |
GoBottom() | Animate the bitmap back to the locked position (nTop = 0) |
GoTop() | Animate the bitmap upward off-screen to unlock the window |
MouseMove( nRow, nCol ) | Track vertical drag distance and reposition the bitmap accordingly |
Example: Unlock Screen
#include "FiveWin.ch"
function Main()
local oWnd, oLock
DEFINE WINDOW oWnd TITLE "App" SIZE 800, 600
oLock = TSliderMetro():New( "lock_bg.jpg", oWnd )
ACTIVATE WINDOW oWnd CENTERED
return nil
Notes
- TSliderMetro is not a TControl descendant; it manages a TBitmap directly via the window handle.
- The background bitmap should match the window dimensions for a seamless full-screen effect.
- Text is drawn on the bitmap using
oBmp:Say()in thebPaintedcodeblock with white color and Segoe UI Light fonts. - Dragging the bitmap more than halfway up triggers
GoTop(), which moves the bitmap off-screen and enables the underlying window. - Dragging less than halfway or releasing below the midpoint triggers
GoBottom(), which snaps the lock back into place. GoTop()disables the source window during animation and re-enables it when complete.