System Controls

The System tab contains non-visual and low-level controls that provide timer functionality and custom drawing surfaces.

TTimer CT_TIMER = 38

Non-visual component that fires an event at regular intervals. Used for periodic tasks such as polling, animations, auto-save, and status updates. Does not appear on the form at runtime.

PropertyTypeDefaultDescription
nIntervalNumeric1000Timer interval in milliseconds
lEnabledLogical.T.Whether the timer is active
EventCategoryDescription
OnTimerActionFired each time the interval elapses
PlatformImplementation
WindowsSetTimer() / WM_TIMER
macOSNSTimer (scheduledTimerWithTimeInterval:)
Linuxg_timeout_add()
// Auto-save every 30 seconds
TIMER oTimer OF oForm INTERVAL 30000
oTimer:OnTimer := { || AutoSave() }

// Temporarily disable timer
oTimer:lEnabled := .F.

// Re-enable with faster interval
oTimer:nInterval := 5000
oTimer:lEnabled := .T.

TPaintBox CT_PAINTBOX = 39

Custom drawing surface. Provides a Canvas object for free-form painting using lines, rectangles, ellipses, text, and images. The OnPaint event is called whenever the control needs to be redrawn.

PropertyTypeDefaultDescription
oCanvasCanvas(auto)Drawing surface object with pen, brush, and font
nWidth, nHeightNumeric200, 200Size of the drawing area
nClrPaneColorCLR_WHITEBackground color
EventCategoryDescription
OnPaintDrawControl needs repainting (receives oCanvas)
OnClickActionSurface clicked
OnMouseDownMouseMouse button pressed (nRow, nCol, nFlags)
OnMouseMoveMouseMouse moved over surface
OnMouseUpMouseMouse button released
PlatformImplementation
WindowsOwner-drawn STATIC (WM_PAINT + GDI/GDI+)
macOSNSView (drawRect: + Core Graphics)
LinuxGtkDrawingArea (draw signal + Cairo)
// Custom drawing on a PaintBox
@ 10, 10 PAINTBOX oPaint OF oForm SIZE 300, 200
oPaint:OnPaint := { |oCanvas|
   oCanvas:FillRect( 0, 0, 300, 200, CLR_WHITE )
   oCanvas:SetPen( CLR_BLUE, 2 )
   oCanvas:DrawRect( 20, 20, 280, 180 )
   oCanvas:DrawEllipse( 50, 50, 250, 150 )
   oCanvas:DrawText( 110, 90, "Hello Canvas!" )
}
2 System Controls

Timer provides periodic event firing for background tasks, while PaintBox offers a free-form drawing canvas. Both are essential for building interactive and dynamic applications.

On This Page

TTimer CT_TIMER = 38 TPaintBox CT_PAINTBOX = 39