[Lazarus] LCL and custom keyboard layouts

Mark Morgan Lloyd markMLl.lazarus at telemetry.co.uk
Mon Jan 30 11:55:07 CET 2012


Felipe Monteiro de Carvalho wrote:
> On Sat, Jan 28, 2012 at 2:32 PM, Mark Morgan Lloyd
> <markMLl.lazarus at telemetry.co.uk> wrote:
>> What is the situation with LCL editing components, Synedit, Cmdline and so
>> on? Is there a single underlying keyboard component, or at least a uniform
>> interface?
>>
>> In short, where do I start? :-)
> 
> All LCL applications use the TWinControl.OnKeyDown, OnKeyUp,
> OnKeyPress and OnUTF8KeyPress events which give almost all information
> about the keyboard. There is also LCLIntf.GetKeyState, but is less
> used. All of those in the end are calls to the underlying widgetset
> which does the real work, we just convert the result from the
> widgetset into the formats supported by the LCL.
> 
> So you should not be thinking initially at LCL support for your
> keyboard, but instead in supporting for example X11 (supposing we are
> talking here only about Linux). I have no idea how X11 interfaces with
> the keyboard, but the LCL interfaces with it via X11 (the most direct
> relationship is only in the LCL-CustomDrawn widgetset, but I think
> that Gtk and Qt use X11 too for their keyboard code). So if your
> keyboard interfaces correctly with X11 then it should work with LCL
> apps too.
> 
> Except for this the other idea which I would have is hacking the LCL
> widgetset code to make use of your custom keyboard directly, but then
> it won't work for pre-compiled applications. Doing this in the
> LCL-CustomDrawn widgetset might be the easiest because it is the
> smallest, but its X11 version still has no text support.

Thanks for that Felipe. So if I'm reading you correctly, as a crude hack 
I should be able to start by hooking OnKeyDown etc. as exposed by 
(instances of) descendants of TWinControl. But there's probably more 
ethical ways to do it based on at least partial replacement of elements 
of the LCL.

-- 
Mark Morgan Lloyd
markMLl .AT. telemetry.co .DOT. uk

[Opinions above are the author's, not those of his employers or colleagues]




More information about the Lazarus mailing list