[Lazarus] What are "widgets" in lazarus?

Hans-Peter Diettrich DrDiettrich1 at aol.com
Sat Jan 8 20:26:11 CET 2011


Bo Berglund schrieb:

> What is a "widget" and how does it relate to my aim of making a
> cross-platform program?

IMO widgets are visual components, provided and managed by a "widgetset" 
library. Many OS (except Linux/Unix) have native widgetsets, and allow 
for user installable widgetsets as well (Qt, gtk...). The LCL tries to 
provide an interface that works with arbitrary widgetsets - as far as a 
concrete widgetset is compatible with that interface. All LCL widgets 
inherit from TWinControl.

There exist other widgetsets that are pure FPC/LCL (fpgui, msegui).

Forms are special widgets, usually managed by a window manager. The 
window manager is platform specific and can not be replaced. The 
*appearance* of forms (and other widgets) can be configured by themes, 
so that most users don't recognize the existence of an window manager. 
Nonetheless the window manager dictates the behaviour of forms, and 
implements a taskbar (if available), and a notification system for 
events (mouse clicks...).

So we have a hierarchy of managers (or libraries):

graphics library (all drawing, fonts, themes)
   window manager (screen management, standard dialogs, taskbar, menus)
     widgetset (provides and manages widgets = TWinControl)
       LCL (also provides unmanaged controls = TGraphicControl)

IOW the frame of every window/form (non-client area) is managed by the 
window manager, while its content (client area) is under control of the 
application. An application can paint the client area itself, and/or it 
can use widgets or other controls for content presentation, as e.g. 
provided by the LCL, VCL, CLX...

DoDi





More information about the Lazarus mailing list