[Lazarus] Developing a WidgetSet
Martin Frb
lazarus at mfriebe.de
Mon Oct 9 04:43:22 CEST 2017
I think there was some work before. (Afaik only carbon, Mac)
Look at TControl properties AccessibleRole, AccessibleValue,
AccessibleDescription.
lcl\controls.pp line 1639
They refer to TLazAccessibleObject (line 990)
Then in control.inc line 150 procedure
TLazAccessibleObject.SetAccessibleValue(const AValue: TCaption);
the widgetset is called
WidgetsetClass :=
TWSLazAccessibleObjectClass(GetWSLazAccessibleObject());
WidgetsetClass.SetAccessibleValue(Self, AValue);
TWSLazAccessibleObjectClass is at lcl\widgetset\wscontrols.pp line 80
TWSLazAccessibleObject is at line 71.
Search in files how it is sub-classed in carbon. Subclass it the same
way in other widgetset.
If you want to subclass it in win32 go to
lcl\interfaces\win32\win32wsfactory.pas line 131
function RegisterLazAccessibleObject: Boolean; alias :
'WSRegisterLazAccessibleObject';
see the commented code. only the gtk reference is a copy and paste. it
needs to register the newly created class for win 32.
A few very short explanations:
Each widgetset (win, gtk, carbon, qt...) exports the methods for
registration. the "alias" makes it visible to the linker.
The LCL refers to those as external functions. So the LCL can be linked
against each widgetset.
Also each widgetset inherits from the classes in the parent folder
(generic classes).
e.g. TWSLazAccessibleObject in lcl\widgetset\wscontrols.pp line 71
and carbon inherits: TCarbonWSLazAccessibleObject =
class(TWSLazAccessibleObject) in lcl\interfaces\carbon\carbonwscontrols.pp
The generic classes are also compiled into the lcl. So the widgetset can
provide the sub classes, and lcl knows how to call them.
On 08/10/2017 21:09, Lubos Pintes via Lazarus wrote:
> Hello,
> If I want to add a functionality like accessibility to WidgetSet,
> which package could I use, lcl.lpk, or lclbase.lpk?
> Also, how can I rebuilt the package when I modify/add some unit? Do I
> need to always rebuild the IDe, or there is a quicker way?
> I am thinking about syntax check / quick compilation to incrementally
> check and fix semantic / syntax errors.
>
> Thanks
>
More information about the Lazarus
mailing list