[Lazarus] What are "widgets" in lazarus?

Hans-Peter Diettrich DrDiettrich1 at aol.com
Sun Jan 9 19:24:31 CET 2011


Graeme Geldenhuys schrieb:

> On a side note: I still have no clue how Qt managed to
> make a smooth transition from "one handle per widget" to "single
> handle per form" design.

Where do you see problems?

The OS has to track some global notification "targets", for e.g. 
keyboard input or mouse capture. These targets are processes (or 
threads) in the first place. With no such global target (e.g. on an 
uncaptured mouse click) the screen/window manager can determine the 
target process from the information, stored with every window. That's 
why forms/windows always have a handle, assigned and used by the window 
manager of a platform.

The determination of a closer target (e.g. control) is up to the 
application or library, that manages the layout of a window. Every 
application or library can freely define their own "handles" for every 
possible notification target, as appropriate to dispatch incoming 
notifications. The "natural" handle of every such target is the address 
of the data structure, that describes the target. The LCL can use the 
addresses of TComponent objects for its handles, while a widgetset can 
use the addresses of its equivalent data objects.

Handles in general can be seen as pointers to data structures, or as 
indices into according pointer tables, that make sense only to the owner 
of those structures, within its own address space. E.g. GDI handles look 
much like indices into some (sparse) pointer array, consisting of areas 
for system wide objects (fonts...), and application or device context 
specific objects.

DoDi





More information about the Lazarus mailing list