Delphi and Lazarus
Trekking and Events
Blog and Forum
Čeština English
Main menu
Delphi and Lazarus
Top downloads
KGrid (23598x)
KControls Component Suite (22881x)
KHexEditor (5278x)
KIcon (2584x)
CAN Event Manager (510x)

KControls Component Suite

KControls is a freeware distribution, a flagship of tkweb. It contains all of my published components for Delphi and Lazarus. All controls have been written with the aim to become both cross-IDE compatible (Delphi/C++Builder VCL and Lazarus LCL) and cross-platform compatible in Lazarus. There are some exceptions to this scheme, see below.

Components included
TKGrid - powerfull control for working with table data, replacement for TStringGrid and TDrawGrid - full compatibility and lot of new features
TKDBGrid - control for working with database tables, possible replacement for TDBGrid
TKMemo - native replacement for TMemo/TRichEdit - written from scratch, great features, full RTF support etc.
TKHexEditor - another useful control for binary file editing
TKIcon - powerfull component for working with icons and cursors (files *.ico and *.cur, works only on Windows)
TKPrintPreview - control for displaying print preview, it is part of KControls built in printing capabilities, every visual control supports printing and previewing
TKPrintPreviewDialog - nonvisual component - dialog - for an easy print preview implementation
TKPrintSetupDialog - nonvisual component - dialog - for an easy implementation of printing preferences
TKCustomControl - a base for your visual controls, for which you want to implement e.g. printing and previewing capabilities in Delphi or Lazarus (just 2 short functions to write).
TKNumberEdit - edit control to input numbers in various formats
TKFileNameEdit - edit control to input file names
TKLinkLabel - label to show clickable link
TKGradientLabel - label with gradient background
TKLog - component for event logging
TKPercentProgressBar - custom drawn progress bar which shows actual percentage of the progress
TKBrowseFolderDialog - wrapper for the standard Windows API browse for folder dialog (works only on Windows)
TKBitBtn - like TBitBtn - draws PNG and alpha channel correctly in Delphi, has WordWrap property, works in Lazarus as well
TKColorButton - just another button to pick color
TKPageControl - page control written from scratch with custom painted tab panel, has tab icons and close button icon


KControls is provided free on 'as is' basis, with complete source code. However, it is licensed software. More information about license can be found in source file headers.

All controls support Delphi and Lazarus IDEs fully. But there are some exceptions: TKIcon and TKBrowseFolderDialog work only on Windows and printing and previewing might not work in some widgetsets in Lazarus.

Note: In Delphi only VCL is supported. FMX will never be supported.


If you want to donate for further development of KControls just think about building your own photovoltaics and using the WATTrouter device produced by our company. You will save lots of energy and it will be the best donation to me you can make!

Screenshots (click the images to enlarge)

KControls components (Windows Vista)KControls components (Windows XP/GTK2runtine)
KMemo rich text editor showing the KMemo manual.KMemo rich text editor showing more complex sample RTF document.

Repository - development versions

You may now download newest development version at bitbucket. Please download and try this version if something is not working in the official release listed below.

Downloading KControls

Important note: When installing the packages in Delphi XE2 and later you must add "Vcl;Vcl.Imaging" to Unit Scope Names in Delphi Options/Library! Otherwise the packages won't compile!

FileVersionNumber of
Available for:Changes
kcontrols_1.7.zip1.79631Delphi 7+,Lazarus 1.2.2+, C++Builder 2007+support for RAD Studio XE8, major work on TKMemo which is already usable, bugfixes...
kcontrols_1.6.zip1.62846Delphi 7+,Lazarus 1.2.2+, C++Builder 2007+support for RAD Studio XE6, Columns property in TKDBGrid, bugfixes...
kcontrols_1.5.zip1.5451Delphi 6+,Lazarus 1.2.2+, C++Builder 2007+new components TKMemo, TKBitBtn, TKColorButton, some bugfixes...
kcontrols_1.4.zip1.41082Delphi 6+, Lazarus 0.9.29(SVN#21827)+, C++Builder 2007+support for RAD Studio XE3-XE5, new components etc.
kcontrols_1.3.zip1.32785Delphi 6+, Lazarus 0.9.29(SVN#21827)+, C++Builder 2007+support for RAD Studio XE2
kcontrols_1.2.zip1.23153Delphi 6+, Lazarus 0.9.29(SVN#21827)+, C++Builder 2007+cumulative update (KGrid 1.7, KHexEditor 1.5, KIcon 2.2)
kcontrols_1.1.zip1.11153Delphi 6+, Lazarus 0.9.29(SVN#21827)+, C++Builder 2007+cumulative update (KGrid 1.6, KHexEditor 1.4, KIcon 2.1)
kcontrols_1.0.zip1.01780Delphi 6+,Lazarus 0.9.29(SVN#21827)+initial release (KGrid 1.5, KHexEditor 1.4, KIcon 1.9)

Important note (September 2018): KControls repository path has changed (see updated link above), has been set completely public (including the issue tracker) and the forum here has been set read only. See here why. I will continue the development of KControls if my time allows it but anyone else is free to make a contribution. In that case please fork the repository, implement, test and commit your changes and create a pull request. I'll merge the changes with the main trunk afterwards, however, I'll not verify your changes anymore for correctness.


Home | Software | Delphi and Lazarus | Trekking, travelling | Sport | Blog

Search in comments: 
inserted: 2018-08-09 07:55:39
From: kevinGH
How do you rotate text in all cells in a row? with stringgrid can override the DrawCellText procedure.
inserted: 2018-06-20 22:53:22
From: TerryMcB
Newbee(s) [ME] are a pain, but that said: I never had much fun in installing Delphi 2->6 components with Borland changing it on every release.

This is a (How to) on installing kControls.

I'm using Win10 and Lazarus v1.8

I've used the latest version of kControls found at bitbucket, and it has a huge long filename.

Download and open the zip file to somewhere nice, extract the zip file somewhere nice.

Note here: the bitbucket file name does change, but mine was called tkweb-kcontrols-0dbad6b6449e.

*NOW* -- COPY the Folder called (tkweb-kcontrols-0dbad6b6449e) to the (components) folder under Lazarus, I renamed my folder to (kcontrols) to make it easier to read.

In Lazarus: find the [Package] menu and select it.
Then find [Open Package File (.lpk)] then select that one.
- It will open a file-dialog.

Navigate to C:\lazarus\components\tkcontrol(whatever you called it)\packages\kcontrols

In this folder (directory), you will see two files, kcontrolsbase.lpz and another one called kcontrolslaz.lpk - select it and then double click.

You will then see a long drawn out box full of files, ignore them and click [USE] - on one of the top menu items.

- Click on second on down that says [Install], the new pop-up will say that Unicorns live here: press accept.

Then press accept that you'll be a fatty.

- And now you can sit back and wait, and wait: and wait - (well: I had to).

Hopefully after Lazarus has rebooted, you should see a new tab at the end called TK.

Now: if you don't, then Install that second file called kcontrrolbase.lpz

I personally had to Install them twice before I finally had that TK tab.

The text above represents an evening of pure frustration: cos this newbee was a confused as (lots) by reading, and then re-reading how to Install new components under Lazarus, and not one of the sets of Instructions I read made sense.

Hopefully, you will have it a bit easier ..

This is a note to all you experts out there, if it's wrong: then tell me an easier way.

Happy tGridding, cos I'm amazed by what these added controls can do, thank-you very much [ tk ] for providing them.

inserted: 2018-06-12 02:43:20
From: DrTheopolis
Does the KMemo component allow changing only part of a text style for a selection, such as font name or font color, without changing all other parts of the text style? In other words, if I select text that has a mixture of fonts, colors, sizes, etc. and just want to change the color but keep the mixture of font names, sizes, etc., is that possible? I've been looking through the code and it does not seem to work that way.
inserted: 2018-06-21 05:29:58
From: Davo
Yes, indeed it does DrTheo. If you know the block number you can do things like

KMemo1.Blocks.Items[BlockNo].TextStyle.Font.Name := 'someFont';

And my good friend Ben found you can -

KMemo1.Blocks.Items[BlockNo].TextStyle.Brush.Color := clYellow;

Check that syntax, its from memory, but you get the idea.

inserted: 2018-06-29 07:28:32
From: см
Davo, I do not think this will work.
As you said, if you know the block number.
Let's assume that block number can be determined (I believe it is possible), but most likelya user would need to change either parts of a block or several blocks (first and last of them might be partial, too). So blocks will need to be repartitioned.
I believe the best solution is to check how it is done (if done) in the RTF editor, bundled with TKControls.
inserted: 2018-06-30 03:42:20
From: Davo
Yes, thats correct CM. I told the simplest story to make for an easy answer because the OP asked if it was possible.

I do quite a lot of the manipulation you mention in my tomboy-ng code (see github), pretty easy once you get going. There are KMemo calls to split blocks and they work fine.

inserted: 2018-07-03 09:56:03
From: см
Sadly, I have wasted an hour or two trying to checkout TKContrown with GitTortouse. I do not feel like trying to checkout anything from enything but a SVN repository, until I happen to have 5 hours free.
Anyway, the OP seems to have forgotten this issue a long time ago.
inserted: 2018-07-04 02:36:36
From: Davo
Hi CM, I don't quite understand your problem. Are you trying to get KControls via a Git tool ? Why ? Just get the zip file.
Or did you mean you were trying to get my tomboy-ng via Git ? It is in a Git repo but if you just want to look at the code or build the app, again, easier to pull down the Zip file from the githup web page, green "clone or download" button, right hand side of page.

Yep, agree OP has left the building. Bit worried that TK seems to have too !

inserted: 2018-07-04 08:22:42
From: см
I need to make some fixes and improvements of KMemo, and I need to remain synchronized with KMemo updates from TK (if any).
So I need GITClient for merging. But GIT does not seem so user friendly as SVN and I could not find a decent tutorial for it. Anyway, if not this year- some next time.
inserted: 2018-07-04 10:28:04
From: Davo
Ah, I see.
I only use git from command line, Linux user ....

inserted: 2018-07-06 08:50:02
From: см
I downloaded a command line client for Git. Possibly you what what I shall tyoe to checkout TKControls?
inserted: 2018-07-06 09:00:09
From: см
I tried
   git clone c:\temp\tkweb
but I got
   Cloning into 'c:\temp\tkweb'...
   remote: Not Found
   fatal: repository '' not found

Probably has to be replaced by sth. else?
Or should I use „checkout‟ as in SVN?
inserted: 2018-07-08 14:19:22
From: Davo
Sorry, don't know. I have only used github.

Googling around indicates that there should be a link on the bitbucket page labelled 'cone' that will give you a valid url. But I don't see one. Does that indicate that kcontrols has had its 'git-ness' deactivated ?

inserted: 2018-06-12 02:25:15
From: DrTheopolis
How do I report an issue? Here?
I just started using the bitbucket snapshot of KMemo component. I am working with the kmemo editor demo. It seems that when I first run the demo, the first letter I press is displayed and the cursor is placed before it. In other words, if I type "this" (without quotes) then I see "hist". If I then delete what I've typed and start again, then it is ok. While stepping through the code, I've noticed in TKCustomMemo.ExecuteCommand that, right after I run the demo and press my first key, TmpSelEnd is set to -1. When I erase what I've type and do it again, then TmpSelEnd is set to 0. I'm using the latest releases of fpc/lazarus and the "hist" behavior happens both on my Windows 10 machine, and also on my Mac using Cocoa widgetset. Is it me, or is it a bug? Thanks.
inserted: 2018-06-13 13:28:54
From: см
Usually the first question is „do you use latest version from bitbucket?‟.
inserted: 2018-06-11 03:57:51
From: Fernando

I am working with TKNumberEdit to input float numbers. I got into what I think is a bug: the control accepts numbers in exponential notation with positive exponent such as 1.75E5 but does not allow negative exponents as 1.75E-5. The problem seems to be in line 1430 of KEdits.pas:
        if (KeyFloat = '-') and (SelStart <> 0) then KeyFloat := #0;
This does not allow a minus sign after the 'E' or 'e' (neither a '+' sign is allowed, by the way). Could this be fixed?
inserted: 2018-06-13 04:45:40
From: Fernando
After some searching, I modified KEdits.pas as follows, starting from line 1428 (in function TKNumberEdit.InspectInputChar) as follows:
      if CharInSetEx(KeyFLoat, ['0'..'9','-', '+', '.', ',', 'e', 'E', DecimalSeparator, #8]) then //added '+'
        if (KeyFloat = '-') and ((SelStart <> 0) and (UpCase(S[SelStart]) <> 'E')) then KeyFloat := #0; //added and (UpCase(S[SelStart]) <> 'E')
        if (KeyFloat = '+') and ((SelStart <> 0) and (UpCase(S[SelStart]) <> 'E')) then KeyFloat := #0; //new line added

There are two lines modified and one new added. Seems to work OK for me. It allows '+' and '-' signs both at start and after an 'e' or 'E'.
inserted: 2018-05-31 21:33:28
From: ozznixon
I have updated the code to work on Lazarus 1.8.4 on Mac.

Add LazUTF8 to the uses clause for Memo and MemoRTF and KFunctions.

Then I had to change MainTheadID from LongWord to TThreadID (where you define ctx). And everything appears to operated on a Mac now. I am still testing ... but, wanted to share this, so others can get KControls working!

* Do you have a function by function demonstration? I used to use TRichView (registered version) on Delphi as a DOS CRT for my GUI application. Now, I am porting to Lazarus, and trying to port all my code to KMemo.
inserted: 2018-06-02 02:12:52
From: Davo
Have you seen ?

inserted: 2018-06-04 11:02:08
From: см
Also, there is kmemo_manual.rtf in the BitBucket repository.
Before starting to port, mind that:
1. There is no RTL support.
2. There are no Undo/Redo capabilities
3. There is no Highlighting
4. There are some compatibility issues with tables
5. Searching is quite tricky (I could share some code about, in case s.o. needs it or when I find some time for that).
and you will have a way to overcome these issues, if they affect you.
inserted: 2018-05-20 18:38:54
From: euMesmo
Hi, first of all thank you for your work with kmemo.
I'm trying to convert the text in a kmemo to html, I can go through the blocks and get the text of each one of them but I can't get the information about the style, bold, font size....
How do I know if a block has bold, italic... or the size and color of its font?
Thank you for your time and work.
inserted: 2018-05-22 08:23:13
From: см
Check this:

It should be something like this:

  i : integer;
  BlockFont: TFont;
  for i:=0 to KMemo1.Blocks.Count-1 do
    if KMemo1.Blocks[i] is TKMemoTextBlock then
inserted: 2018-05-24 15:18:35
From: euMesmo
It's works fine. thank you for your help.
inserted: 2018-05-18 11:41:28
From: Maurice

First, thank you for the component

Sorry for this probably very simple question.

When I drop the tkMemo component on a empty form and I run the application. Everything runs fine, but I'm only seeing and emty tkmemo. No rich edit option like bold/italic etc?

I'm I using the compoents wrong?


inserted: 2018-05-19 11:46:24
From: см
That is how it is expected to be.
You should add buttons, etc yourself if you need to. I myself do not need them
There is an entire RTF editor in the component example, with buttons, etc. so you can use it.
inserted: 2018-05-24 08:54:42
From: Maurice

Thx for the reply,

I see now what you are doeing there! Thanks for pointing me in the right direction!

inserted: 2018-05-13 18:04:20
From: freq
I am trying to install KHexEditor on Delphi Rad Studio 10.2 face error did anyone try to install on 10.2
inserted: 2018-07-21 00:53:45
From: Caster Spain Europe
I know it is not the right answer, and the creator of the components can correct it better, but this works for me with all components with Delphi DX10.2.
The following lines must be added in the file "", in the corresponding site:

// Mod 1 by Caster
// Only DELPHI

{$ IFDEF VER320}

{$ IFDEF VER310}

{$ IFDEF VER300}

// End. Mod 1

{COMPILERx_UP directives from COMPILERx}
// Mod 2: by Caster
// End Mod 2.
inserted: 2018-05-08 10:54:25
From: Mitsch
I use the TKMemo with the PrintPreviewDialog. My problem is the last line on the page (I've got 2 pages). The letters are cutted horizontally. That means, the bottom of the letters isn't shown on the page. These is shown on page 2 and so the last line is sepparated onto two pages. Is there a property to set the linewrap/pagewrap for a page?

inserted: 2018-05-02 11:49:47
From: см
When I examined the output of KMEMO1.RTF it occurs that cyrillic letters are converted to ASCII instead to Unicode.
Indeed, there is \ansicpg1251 in the header, so I guess the document shall be readable.
But is it possible to force KMEMO to use unicode only?
inserted: 2018-05-13 06:59:53
From: Davo
CM, do you mean in a RTF file exported from KMemo ? If so, its possibly the issue I have documented here -

KMemo, when copying to the clipboard or exporting as RTF, has a problem with UTF8 characters. Relates to some invalid assumptions about codepage IHMO.

TK was informed about a month ago ....
inserted: 2018-05-15 11:08:35
From: см
The following code:
  Memo1.Text:= KMemo1.RTF;
results in
{\rtf1\ansi\ansicpg1251\deff0\uc1{\fonttbl{\f0\fcharset1\fprq0 Arial;}}{\colortbl\red255\green255\blue255;\red0\green0\blue0;}{\*\listtable}{\*\listoverridetable}{\f0\fs20\cf1 \'CF\'F0\'EE\'E1\'E0}}

This RTF seems okay, MS Word opens it, but I strongly dislike ANSI which always creates troubles (as you have found and reported).
inserted: 2018-05-16 08:58:00
From: Davo
OK CM, here is what I get with the patches defined on the Lazarus Wiki Page (only the interesting part) followed by your equivalent -

{\f0\fs20\cf1 \u1055\'3F\u1088\'3F\u1086\'3F\u1073\'3F\u1072\'3F}}

{\f0\fs20\cf1 \'CF\'F0\'EE\'E1\'E0}}

I confess I struggle with unicode but from what little I know, I think my version looks like unicode in RTF should.

inserted: 2018-05-19 11:36:03
From: см
I suppose you get real unicode, because your OS is set to NON CP1251.
My Win7 is set to CP1251 (Cyrillic), so for some reason TKmemo decides to use CP1251 for Cyrillic and unicode for anything else (German, Chinese, etc).
Maybe Linux will generate Unicode only, disregarding local settings.

BTW, if you have an account in the Lazarus forum, you could contact me there:;u=47657
inserted: 2018-04-11 13:07:35
From: lopezan
Hi, when I try to install it on Lazarus 1.8.2, I have the error:
kmemortf.pas(4030,10) Error: Identifier not found "UTF8Copy"
inserted: 2018-04-14 21:55:55
From: tk
Please use the latest snapshot from bitbucket. This should work fine.
inserted: 2018-04-03 22:13:59
From: flyby
Hi there...awesome tools btw.

One question, when inserting a table into a memo, I want to set the width of cell[0], but cannot find the correct property to do so. Or maybe there is a property to set cell[0] to the largest value placed into it?

Thank you again.
inserted: 2018-04-04 14:04:01
From: см
Settting width or height of a *cell* does not seem to make sense.
You should be able to set .width of a *column* and .height of a *row*.
Try aMemoTable.ColWidths[0]:=...
If it does not work try (I think it will) something like .requiredwidth.
inserted: 2018-04-04 19:00:11
From: flyby
CM, I apologize, been looking at cells so much it was stuck in my brain. Yes, column width is what I'm looking for.

I tried your suggestions, but it seems the properties are being ignored. The width never changes. It's fixed someplace. It appears the table columns do not dynamically set themselves to the greatest value in the table columns, which is not that big of a deal if I could find the property to set them myself. Thank you again.
inserted: 2018-04-05 00:01:24
From: flyby
Getting closer. If you set the FixedWidth property to true, it looks like it dynamically shrinks the columns to fix the text.
inserted: 2018-04-05 08:38:47
From: см
Hm, I am quite sure it does not. I am using my dedicated routines to adjust columns according content. Or if it does- it widens them, but does not shrink when possible.
inserted: 2018-04-05 00:07:13
From: flyby
Ah, got it figured out. It's combination of these properties and settings.

TBL.ColWidths[0] := 30;
TBL.ColWidths[1] := 300;
inserted: 2018-04-05 08:42:01
From: см
Note that TBL.ColWidths[0] := 30 + TBL.ColWidths[1] := 300 = 330
while the entire table is 300 pixels wide.
If total width of columns is higher that the width of the table expected result is unpredictable.
What if you leave TBL.ColWidths[1] := 300; out? It does not need seem necessary to me.
inserted: 2018-04-05 17:15:37
From: flyby
CM, yes, you are correct. This was just some test code I was playing with. Thank you for the help.
inserted: 2018-03-26 08:58:11
From: nomorelogic
hi tk
First of all, thanks for these components, they're really good.

I've a question about undo/redo: I can see TKMemoChangeList il managed but function DoUndo is not yet implemented.
Does this mean that undo is not implementable because it lacks some basic functionality?

thanks in advantage
inserted: 2018-03-30 14:44:25
From: Stilgar
KMemo great component but... undo/redo are still unimplemented? From 2015?
Can you explain how we can implement such functionality?
Looking in source code i've found a skeleton of implementation. KMemo have a Undo List and a Redo List. (TKMemoChangeList).
For example AddUndoString is defined but where is call? :(
inserted: 2018-04-14 21:53:44
From: tk
Yes this is the empty skeleton from KHexEditor, just function naming was changed. For KMemo it has to be much more complex. Unfortunatelly I have no time for this task now and will not have time for this in foreseeable future. If you want to implement this feature you're free to go but please observe contributor terms in the readme. Testing is crucial, it must work both in Delphi 7 and later and Lazarus in all major widgetsets. If that's well tested and working send me a patch to publish it.
inserted: 2018-03-24 11:25:22
From: Davo
I'd like to bring to your attention a problem I can demonstrate in both the KMemo and KMemoEditor demo applications that come bundled with KControls. And, obviously, in my own KMemo based app too. Only under Linux.

Step by step ? Open the demo KMemoEditor, click 'new' to get a new KMemo. Enter two lines. Make the first line a bullet, select and copy the second line, paste. In my case, the bullet character changes to the invalid UTF8 character, i.e. the black diamond with a question mark.

When this happens, a large number of GTK errors appear on the console -
(KMemoDemoLaz:7195): Pango-WARNING **: Invalid UTF-8 string passed to pango_layout_set_text()

Conditions are quite critical to reproduce. Firstly, you must copy something from a KMemo that already has a bullet. Then paste it into a KMemo that has a bullet. That triggers it. Copying an apparently identical piece of text from a KMemo that does not have any bullet in it won't trigger !

It does not matter where in the KMemo you copy from or paste back into.

A related (?) issue seems to be when you copy and paste a UTF8 char, if it is both from and to a KMemo, it fails. Paste it elsewhere and recopy and you can paste it successfully back into the original KMemo window or another one.

Very strange behaviour !
inserted: 2018-03-26 12:51:25
From: Davo
Sorry TK, I raised two issues in one message, I should know better.

Anyway, to demo the copy UTF8 (on linux, Lazarus 1.8) issue, very easy.

New Form, drop a KMemo on it, compile and run.

Then, copy some UTF8 (ie non-ASKII) characters into the KMemo (Ctrl-V). They appear fine. Then, in the KMemo, select the same characters, and copy the selection (Ctrl-C), click at the end to clear the selection and paste, Ctrl-V.

In my case, invalid characters appear. What were two byte UTF8 characters become one byte characters in the ASKII set above char(128) which should not, of course, appear in a UTF8 string.

No sign of either issue on Windows.
inserted: 2018-04-08 02:52:02
From: Davo
For the record, both these issues (cannot copy and paste UTF8 and pasting messes with Bullet symbol) also manifest themselves on the Mac.

I suspect at least the former relates to KMemo copying to the clipboard data it sees as RTF. If the clipboard contents does not think its RTF, the pasting UTF8 issue does not present.
inserted: 2018-04-11 08:05:27
From: Davo
OK, here is a summary of whats happening -

On windows, the call to StringToAnsiString(C, FCodePage); at kmemortf#4098 converts a single Unicode multibyte character (in the var C) to single byte (code page aware ?). On linux, it is not changed, that is, it remains a two byte unicode character. That is because in LConvEncoding#7392, the function ConvertEncoding(const s, FromEncoding, ToEncoding: string
): string; has decided the string does not need to be converted. Effectively, as GetDefautTextEncoding() returns 'utf8', we are asking it to convert UTF8 to UTF8.

So, quite reasonably, It decides to pass the string back as it is, still in multibyte form.

However, a little further down, the first byte of C is used to generate the RTF string that will be pushed into the clipboard.

Obviously, in Linux, this is wrong, the first byte does not describe the character. Indeed, having a character like that there, that look like its the first byte of a unicode character messes with the unicode display in KMemo (when and if its pasted back in).

inserted: 2018-04-14 21:43:00
From: tk
So iiuw this is GTK2/3 only issue and nothing to do with KMemo? If yes then please report bug on Lazarus bugtracker. Btw what about MAC?
inserted: 2018-04-17 13:06:02
From: Davo
Its not a GTK bug, its two separate bugs in KMemortf.pas. Code Page dependant.

It affects copying and pasting between KMemos on Linux/Mac (they use the same code page) when Unicode is involved. And reading and writing RTF files that use Unicode. Note that Bullets use the Unicode bullet char ...

I have documented a fix for both issues on the Lazarus Wiki,

inserted: 2018-03-02 02:00:24
From: Davo
The Blocks.Delete() function in KMemo is puzzling me. I can delete a word starting at TKSelectionIndex(Index) like this -

for Cnt := 1 to UTF8Length(TheWord) do

And it works fine as long as -

1. No other text in the KMemo is selected at that time. If it is, the "other text" is deleted with first iteration and then a character is correctly deleted for each subsequent iteration.
2. We don't delete the last character in a block. Doing so triggers an exception if we have called LockUpdates().
Making use of what might be an "unintended feature", that is selecting the text to delete and calling DeleteChar() with some random parameter does delete the selected text, does not care about LockUpDate() status and is faster. Like this -

TheKMemo.SelStart := Index;
TheKMemo.SelEnd := Index + UTF8Length(TheWord);

But it does look like I am using DeleteChar() in a way you did not intend and might "fix" in the future.

Thoughts ?
inserted: 2018-03-11 16:31:12
From: tk
I am not sure what you want to do:
1.If you want to clear your selected text (SelStart to SelEnd) then use ClearSelection.
2.If you want to simulate pressing Delete and Backspace keys then use ecDeleteChar or ecDeleteLastChar commands.
inserted: 2018-03-15 09:40:26
From: Davo
I want to delete, for example, a word independent of what is, or is not selected.

It looked like .deletechar(x) was suitable but it delivers a surprise iff something happens to be selected. That something is deleted instead, even if its at the other end of the document, the passed parameter is ignored.

After the first call, deletechar(x) has deleted the selection and therefore nothing is selected, subsequent calls to deletechar(x) behaves as expected, the char at x is deleted.

If this is intended behavour, I'll use it. I save the existing selection values, set them to what I want to delete, call deletechar() (or even ClearSelection()) and restore the previous selection values. Not hard but I don't believe in doing things unnecessarily or depending on things that look "surprising".

inserted: 2018-03-21 15:59:17
From: tk
I would not do it otherwise. This is how I would do it even in normal memo. Different approach would be needed only to remove complex structures like tables or positioned objects from kmemo.
inserted: 2018-03-24 01:30:14
From: Davo
OK, thanks, I'll mention this approach on the lazarus Wiki.

inserted: 2018-02-20 07:39:40
From: см
Could someone share info if Arabic (or other right to left) languages are processed properly in Delphi?
In Lazarus 1.8 words in Arabic are improperly ordered: if there are two words, the one which should be on the left is printed on the right (and vice versa).
I have read that there are some related fixes in Lazarus trunk, so it might be useful to know if the problem is in TKMemo or in Lazarus.
inserted: 2018-03-11 16:33:56
From: tk
RTL languages are not supported by KControls at all. Something may work though.
inserted: 2018-03-13 08:08:02
From: см
Okay, but if it happens to work in Delphi the fault shall be sought in Lazarus and this would be a significant hint.
inserted: 2018-03-21 16:37:38
From: tk
I would bet Delphi and Lazarus will behave differently in this regard. But I cannot say more, because I don't understand any of such RTL languages.
inserted: 2018-03-23 09:04:13
From: см
Neither do I understand any of these, I comapare them as images ;)
In Lazarus both words are displayed reverse (the word on the left is displayed on the right and vice versa).
SO if توماش is shown on the left things are possibly okay. If it is on the right side- things are definitely wrong.

  KMemo1.Blocks.AddTextBlock ('مرحبا توماش');
I will ask for assistance in the Lazarus forum. Possibly s.o. from the LTR countries has Delphi.
inserted: 2018-02-15 08:22:35
From: см
I have troubles with ScrollBy (example below) in Lazarus 1.8.
1. If I try to use KMemo1.ScrollBy(0,20,True); my app does not compile, saying
„Error: Wrong number of parameters specified for call to "ScrollBy"‟.
If I press alt+arrow_up in the IDE I am taken to ScrollBy defined in kmemo.pas
2. If I remove last parameter and try to use KMemo1.ScrollBy(0,20); nothing happens when executing the code (no scroll is done, I tried +20 and -20).
If I press alt+arrow_up in the IDE I am taken to ScrollBy defined in Controls.pp.

I guess something goes wrong with visibility of ScrollBy?

procedure TForm1.Button1Click(Sender: TObject);
  i: integer;
  for i:=1 to 50 do
inserted: 2018-03-11 16:20:19
From: tk
KMemo uses its own ScrollBy and it is protected. You have to use ecScrollXXX commands or make your own descendant to make it public.
inserted: 2018-03-14 11:26:42
From: см
So if I get you right I should use
  for i:=1 to 5 do KMemo.ExecuteCommand(ecScrollUp)
inserted: 2018-03-21 16:32:21
From: tk
For example. I've made TKmemo.ScrollBy public now as this allows you to scroll the memo content freely.
inserted: 2018-03-23 14:23:38
From: см
I have downloaded it from BitBucket and tried KMemo1.ScrollBy(5,5,True); on Lazarus 1.8.2 but it wont compile.

It says
unit1.pas(49,28) Error: Wrong number of parameters specified for call to "ScrollBy"
Error: Found declaration: ScrollBy(LongInt;LongInt);
inserted: 2018-02-13 19:13:30
From: RedOctober
I am just starting to use Lazarus after having used Delphi for 15 years. I'm using the Lazarus "Fix" version which is 1.8.1. In the Lazarus forum, some one suggested I use KMemo. I downloaded your v1.7 and tried to compile and the compiler complained about the UTF8Copy (and Character) functions. I added the unit LazUTF8 to the necessary "Uses" clauses and it compiled and installed your components. My next step was to uninstall the v1.7 then install your latest version from bitbucket. The v1.7.1 from bitbucket has a .lpk but the Package installer complains that there are no registered components in it, so the Lazarus IDE will bloat up, and no components will be visible on the componenent palette. I proceded with the install then uninstalled. (I did notice that the compiler did not complain about any UTF8 stuff, which was my original goal installing your latest version from bitbucket)

My question is: How do I install your latest .lpk from bitbucket so that the components show up on the component palette? Thanks in advance for any help you can provide.
inserted: 2018-03-02 02:06:43
From: Davo
RedOctober, current trunk works fine with 1.8.0 (I have not tested with 1.8.1 and bet you could work fine with 1.8.0 too).

But maybe, after you installed, you did not scroll the the component palette far to the right ? The K components appear on a tab to the right of an already long list....
inserted: 2018-03-02 22:27:12
From: RedOctober
Hi Davo. After install of the trunk (when the Lazarus package installer complained that there were no registered components) I scrolled all the way through all my component tabs. Nothing there regarding TK. So I uninstalled the trunk and installed the 1.7 and the TK components appeared correctly and the compiler did not complain about non-registered components.
inserted: 2018-03-11 16:52:29
From: tk
Sorry for misunderstanding in my last answer. Now I tried the KControls trunk with fresh installed Lazarus 1.8.2 on my Windows 10 and everything works fine, I see the components on palette, am able to drop them to forms, run the demos etc. So it seems your Lazarus is not properly configured.
inserted: 2018-02-14 22:13:28
From: tk
Please use the trunk, download from bitbucket. And you should be fine with compilation. 1.7 is rather historic snapshot and might not work with newer Delphi/Lazarus. Unfortunatelly I have no time now to push the development towards 1.8. I am very busy with my company and other things now...
inserted: 2018-02-08 15:09:23
From: см
Hi Tk,
Since the very beginning I have had problems with tables staying locked.
I think I have finally found the solution and possibly the reason for that.

My code was someting like:

Now it is something like:
  if KMemo1.Blocks.UpdateUnlocked= true then

Looking in the code of TKMemo it occurs that locking state is stored by an integer FUpdateLock, and each time LockUpdate is called FUpdateLock is increased.
Is there (still) a reason for that behaviour (using INT instead of BOOL), or shall I write in wiki, that LockUpdate shall be called only this way:
    „if KMemo1.Blocks.UpdateUnlocked= true then KMemo1.Blocks.LockUpdate;‟?
inserted: 2018-02-09 08:24:22
From: см
Well, it not so hard to see why FUpdateLock is a counter.
I have modified TKObjectList.UnLockUpdate in Kfunctions.pas. I think it should work, at least it did not crash (I have already added „if ...updateunlocked‟ in my code, so I cannot tell without undoing that).
I wonder if the default value should be True or False. „False‟ will require no other changes in the source of KMemo, „True‟ seems more fail-safe for the end userс.

//If FullUnlock=True KObjectList gets unlocked, disregarding the value of FUpdateLock
procedure TKObjectList.UnLockUpdate(FullUnlock : boolean= False);
  if FUpdateLock > 0 then
    if FullUnlock
      then FUpdateLock:=0
      else Dec(FUpdateLock);
    if FUpdateLock = 0 then
inserted: 2018-02-14 22:10:30
From: tk
I am not sure what you mean or where the problem is. Each LockUpdate should be paired with UnlockUpdate. If forgotten somewhere, the respective blocks stay locked and you might get unpredictable behavior. If so, you should review your code and try to find where UnlockUpdate is missing. Always use try-finally clause:


And you should be fine.
inserted: 2018-02-15 08:04:31
From: см
Actually I am making a proposal for you to consider adding a parameter FullUnlock in UnlockUpdate, as seen in the code in my previous post. This will be useful when one needs to make sure that Unlock will happen (instead of looping until .UpdateUnlocked=True)

I will add this info in the Lazarus wiki.
inserted: 2018-03-21 16:21:09
From: tk
I don't see a reason for that. If you have such needs then it seems to me you forgot to call UnlockUpdate somewhere and your code is not clean. Please pair each LockUpdate with UnlockUpdate as I said above and you will not have any problems (of course I cannot rule out that there is still some bug in kcontrols code but everything in this regard should be already well tested).
inserted: 2018-02-01 09:43:39
From: andrey
Hello! Is it possible to set the alignment of the text at column title (KDBGrid), separately from the alignment in the data cells? Is there some suitable property, like "TitleAlignment" ?
inserted: 2018-01-28 14:52:35
From: Gicla22
Hello TK and thanks first of all.
I recently downloaded latest KControls version and tried to use with Lazarus 1.8 but when compiling projects I get the below error:

Warning: other unit files search path (aka unit path) of "KControlsLaz 1.7"
contains "C:\lazarus\components\KControls_1.7\source", which belongs to package "KControlsBase"
Warning: other unit files search path (aka unit path) of "KControlsBase 1.7" contains "C:\lazarus\components\KControls_1.7\source", which belongs to package "KControlsLaz"

I tried to uninstall, clean up directories and reinstall but no way.
How can I fix it?
inserted: 2018-02-14 22:04:45
From: tk
IMO there is a bug in Lazarus causing these warnings.
There is no reason why different packages could not take units from the same directory.
At least these warnings should be optional, an option to turn them off should exist in package project.

I asked myself on the forum some time ago but no answer.,34822.msg229128.html#msg229128

I had no time to file a bug report.
inserted: 2018-01-29 06:18:04
From: Davo
Gicla22, its actually only a warning, not an error. Its been there for a while now and does no do any harm. I confess I have been ignoring it.

inserted: 2018-01-29 08:45:37
From: Gicla22
Thanks Davo for the info.
In fact I continued to debug my code and found that the problem I have it's not related to KControls.
inserted: 2018-01-26 04:29:42
From: Davo
Hi TK, you have not heard from me for a while (good, eh ?). Been building a replacement for Tomboy Notes in Pascal and, of course, KMemo.

KMemo is such a product ! Thanks

However, I am having an issue with cut, copy and paste. Two separate issues in fact. Firstly, you sensibly respond to Ctrl-[xcv] but on a Mac, because its a Mac, it should be another shift key, the "Command" key. Stupid but true !

The other issue is more subtle. On Linux and Windows the cut, copy and paste do not work when an app is first started. It takes a couple of repeated cycles and then does work fine for the run time of the app. Same result whether you use the (eg) Ctrl-v or a menu driven call to KMemo1.ExecuteCommand(ecPaste);

To further complicate, it does work first up occasionally. And, yes, I can demo this in a simple app. Once it starts working, its OK, so I am wondering if there is some initialization required I don't know about ?

I'm using head version of KControls (couple of months old) and Lazarus 1.8

inserted: 2018-01-27 11:53:41
From: tk
1. The Command key on MAC: I am not a MAC expert but I think even Lazarus itself does not respond to this key and it IMO can't because there is no ssCommand modifier in Classes.TShiftStateEnum. To test on MAC I just use a virtual MAC where I remapped all keys to suit my Windows keyboard and default Windows behavior.

2. Cut, copy and paste work fine for me in the KMemo demos (all supported platforms). Did you try with these demos? If yes then maybe Lazarus 1.8 is buggy (but this I doubt even though I always use Lazarus trunk) or you have another problem in your PC like a virus, hardware problem etc. If no then there is problem in your program using KMemo.
inserted: 2018-01-28 00:35:36
From: Davo
Thanks for the Mac fix, will have a go at it today.

Yes, I have seen the copy and paste issue in KmemoEditorLaz. But a lot less often (??). Spent an hour or so this morning trying to identify a pattern but nothing clear. But an impression that I see the problem in my simple demo only when my main app is running. Conversely, I see the problem lot less in my main app when your demo IS running ! I suspect my current data is more noise than data ...

Can you suggest where I should set a watch to see (eg) ctrl-v being handled ?

I am quite sure I don't have a hardware issues and pretty confident about viruses (linux), its a code issue and probably in my code. I do intercept keystrokes going to KMemo to do thinks like check for backspaces around bullets and some other application specific stuff.

Thanks for your help !
inserted: 2018-01-27 12:34:29
From: tk
Reply to myself ad 1) Actually found this now:
Here the ssMeta should be connected to the Apple Command key. I've added at least the 3 basic commands to the default keymap.
inserted: 2018-01-29 06:15:11
From: Davo
Some embarrassment when I realized I was still using Lazarus V1.8rc3 on my build machine. Its setup to do a number of cross compiles and I have been lazy with updating it.
So (real) lazarus 1.8 and the current head version of KControls seems to have fixed my copy and paste errors. Of course, I'm not sure which...

And, yep, you have fixed the Apple's (bless them) rather unique problem with Command rather than Control key to copy etc

Thanks TK.
inserted: 2018-01-21 14:53:54
From: velas
Hello. Excuse for the wrong English - it is machine translation.
 Lazarus 1.6.4, KControls 1.7. Whether KGrig.FixsedRows TKGrid title printing on each new page of the report (on one page is not located) is possible. Whether it is possible to place several object TKGrid variables in one report.
inserted: 2018-01-27 11:23:47
From: tk
Fixed rows only appear at the first page now.

For several TKGrids in one page you would need to write your own printing algorithms.
inserted: 2018-01-21 13:50:30
From: fedor

I found error at TKCustomGrid.FindRow
There are
while Index < ColCount do
while Index < RowCount do

So sometimes FindRow return -1 (if ColCount < RowCount)
inserted: 2018-01-27 11:15:53
From: tk
Thanks will be fixed in next commit.
inserted: 2018-01-12 21:19:48
From: budboy

procedure TForm1.KGrid1EditorCreate(Sender: TObject; ACol, ARow: Integer;
  var AEditor: TWinControl);
  If (ACol = 0) or (ARow = 0)
    AEditor := TEdit.Create(nil);

  If (ACol = 1) and (ARow = 1)
     AEditor := TComboBox.Create(nil);
     TComboBox(AEditor).Style := csDropDown; // cannot set height on Win!

  If (ACol = 2) and (ARow = 1)
     AEditor := TCheckBox.Create(nil);
     TCheckBox(AEditor).Font.Color := clRed; // applies only without OS themes (in Delphi)

procedure TForm1.FormCreate(Sender: TObject);
  KGrid1.Cells[1,0] := 'ComboBox';
  KGrid1.Cells[2,0] := 'CheckBox';

That's what I wrote, and at startup you do not see what's in the cell.
If I turn on the checkbox, switch to another cell, then back, it will not stay on.
inserted: 2018-01-21 14:12:48
From: fedor
see example of usind events "OnEditorDataFromGrid" and "OnEditorDataToGrid" in demos
inserted: 2018-01-09 19:03:55
From: hoyosfelix
Thanks for those components you released for the community.
I'm testing the KGrid component with Lazarus 1.4.4 and Firebird database.
When I show numeric values within the TKDBGrid the columns show number with a question mark infront of it:

? 1.400
? 0
? 21

I would like to know how to change the display format for numeric value.

Thanks again.
inserted: 2018-01-27 11:09:18
From: tk
Hard to say what's wrong. Since I don't use databases at all now, you would have to debug TKDBGrid and find out the cause, yourself.
inserted: 2018-01-03 12:01:32
From: см
Hi TK and Happy new year!
Similar to discussion from 2017-09-12:

kmemo.pas contains the following line:
cDefaultWordBreaks = [cNULL, cSPACE, '/', '\', ';', ':', '(', ')', '[', ']', '.', '?', '!'];...
Should apostrophe (') also be added?
inserted: 2018-01-03 14:26:02
From: см
Hm, actually the issue is that when I double click on a text wrapped in apostrophes it gets selected together with them.
This should not be an issue of cDefaultWordBreaks, since wrapping on an opening apostrophe is a nonsense.
inserted: 2018-01-04 10:58:43
From: tk
I think it is correct now. Apostrophe should not be a word break. For example the word: isn't. It is one word. Surely there might be exceptions in different languages but this goes beyond the scope of KMemo.
inserted: 2018-01-04 11:21:57
From: см
Does selection of words on double click depend on cDefaultWordBreaks or on something else?
I tried
Asfsadf 'safdsafsafd' afsadf
Asfsadf "safdsafsafd" afsadf
in Wors, Lazarus IDE, in a text editor and in the web-page of TKWeb. I all of them double-clicking on safdsafsafd selectes the text withput the quotation marks/ apostrophes.
TKMemo seems to be the only exception.
inserted: 2018-01-08 22:47:06
From: tk
I see now. Quotation marks (single or double) are not word breaks. There must be some other logic in Word, browsers etc. which is not yet implemented in KMemo.

Actually the behavior between different programs varies here.
Example: you've
MS Word correctly selects entire contraction(irrelevant where you double click), Firefox selects either 'you' or 've' on a double click.

Afaik for both single quotation marks and English contractions, possessives etc. the same character (U+0027) is used, which means there must be some extra logic to distinguish them.
inserted: 2018-02-09 15:28:46
From: edvoigt
Hi tk,
I think single quotation marks embedded by letters, like in you've or let's. So there is a difference to real quotation.
Thanks for your Work on KControls!
inserted: 2018-01-09 09:46:38
From: см
Behaviour like in FF seems fine to me, „I've‟ is quite an exception, maybe they Word has a dictionary for exceptions.
I guess all of them use different character lists for wrapping and for double-click selection.
inserted: 2018-01-10 15:53:03
From: см
Currently cDefaultWordBreaks = [cNULL, cSPACE, '/', '\', ';', ':', '(', ')', '[', ']', '.', '?', '!']
This way words might be wrapped at ( and [ which shall not happen.
Probably it would be a good solution to create the Words[..] array according a full list of word breakers (including ()'"„‟«»... etc) and "blacklist" some of them during wrapping, but not during doubleclick.
inserted: 2017-12-12 02:19:10
From: DanishMale
I have upgraded to Lazarus 1.8.0 x64 on Windows, when I try to install KControls I get this log and an exit error:

Compile package KControlsLaz 1.7: Exit code 1, Errors: 1, Warnings: 5, Hints: 4
kgraphics.pas(373,15) Warning: An inherited method is hidden by "Clear;"
kgraphics.pas(528,15) Note: Virtual method "Paint;" has a lower visibility (protected) than parent class THintWindow (public)
kgraphics.pas(542,15) Note: Virtual method "Paint;" has a lower visibility (protected) than parent class THintWindow (public)
kgraphics.pas(1079,36) Warning: Symbol "Handle" is deprecated
kgraphics.pas(3020,3) Note: Local variable "TextPtr" is assigned but never used
kgraphics.pas(3052,3) Note: Local variable "TextPtr" is assigned but never used
kmemo.pas(1525,78) Warning: Symbol "CM_SYSCOLORCHANGE" is not implemented
kmemo.pas(1696,14) Warning: An inherited method is hidden by "ScrollBy(LongInt;LongInt;Boolean):Boolean;"
khexeditor.pas(675,78) Warning: Symbol "CM_SYSCOLORCHANGE" is not implemented
kmemortf.pas(4030,10) Error: Identifier not found "UTF8Copy"

I hope you can help adjusting KControls to this new Lazarus version, aas far I have been able to establish is the function UTF8Copy deprecated (
inserted: 2017-12-12 02:32:24
From: DanishMale
Ignore this.... found your development version and it compiles perfectly....

Thanks for a GREAT piece of software
inserted: 2017-12-03 17:48:45
From: Robert
Is it easy to change TKGrid so it prints pages as columns?
I mean multi column printing like in Acrobat Reader or LazReport.
inserted: 2017-12-05 21:30:35
From: tk
I don't know what you mean, please put a screenshot somewhere and provide a link to it here.
inserted: 2017-12-22 00:18:45
From: Soner
poFitToPage option is in multi-column-page-print-mode not important.
Multi-column-page ist usefull when kgrid has up to four thin columns and the user wants save paper.
inserted: 2017-12-22 00:01:45
From: Soner
I made it but some things are missing. Here is the link with images and modificated files. Maybe you can build it to end. Also I put to the zip KGrid as Treelist, i made it years ago but never used it.!AvJGv-C_3b-WgQoq5d5E9DirKmqL

(The comment above is from me, i don't know why nickname is shown as robert)
inserted: 2018-01-04 10:45:17
From: tk
I see now. KGrid does not support this - personally I never needed this.

We also adapted KGrid to behave as treelist, but not as new control, only with available methods and events.
Older comments
My account
Recently modified

KControls Component Suite

by: tk



by: tk



by: tk



by: tk


KGrid 1.3 released.

by: tk


Recently inserted

Closing this site!

by: tk



by: tk


Grouping of comments

by: tk



by: tk


My recent work on KMemo

by: tk