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

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 - powerfull 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 about cross-platform development in Delphi: I strongly disagree with the way Embarcadero took with the FMX library to allow cross-platform development, so FMX will never be supported. As Lazarus has become very good IDE, in many aspects better than Delphi, I recommend you try it if you need cross platform features.


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. But be careful! These versions are mainly tested in Delphi XE where our main development is still ongoing!

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.71888Delphi 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.62481Delphi 6+,Lazarus 1.2.2+, C++Builder 2007+support for RAD Studio XE6, Columns property in TKDBGrid, bugfixes...
kcontrols_1.5.zip1.5302Delphi 6+,Lazarus 1.2.2+, C++Builder 2007+new components TKMemo, TKBitBtn, TKColorButton, some bugfixes...
kcontrols_1.4.zip1.4939Delphi 6+, Lazarus 0.9.29(SVN#21827)+, C++Builder 2007+support for RAD Studio XE3-XE5, new components etc.
kcontrols_1.3.zip1.32677Delphi 6+, Lazarus 0.9.29(SVN#21827)+, C++Builder 2007+support for RAD Studio XE2
kcontrols_1.2.zip1.23045Delphi 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.11061Delphi 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.01651Delphi 6+,Lazarus 0.9.29(SVN#21827)+initial release (KGrid 1.5, KHexEditor 1.4, KIcon 1.9)

If you have a question you may ask below and I will probably answer it, after some time.


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

Search in comments: 
inserted: 2016-02-01 05:49:30   Reply...
From: heri
how setting cell word wrap
inserted: 2016-01-31 18:05:30   Reply...
From: johnvantelli

I set ColCount = 3
and in my formCreate set col 2 not visible

but scrolling cells program freeze!!
Any ideas??


procedure TForm1.FormCreate(Sender: TObject);
inserted: 2016-02-01 11:48:27   Reply...
From: tk
Cols[x].Visible is buggy. Use ColWidths[2] := 0; as workaround.
Same for Rows.
inserted: 2016-02-01 20:35:57   Reply...
From: johnvantelli
same problem...

I set:

FixedRows := 0;
FixedCols := 0;
ColCount := 3;

ColWidths[0] := 200;
ColWidths[1] := 0;
ColWidths[2] := 0;

but moving cell cursor on right program freeze
I think the problem is that component try to set focus on an invisible cell.
inserted: 2016-02-03 16:17:25   Reply...
From: tk
I can confirm there is some bug causing KGrid to freeze, even in Delphi. Some recent update introduced this blocker. Please, give here the Lazarus version and what demo causes the crash.
inserted: 2016-02-08 19:34:07   Reply...
From: tk
This bug was not in KGrid but in another place of our application.
inserted: 2016-02-03 13:46:42   Reply...
From: tk
Is it fresh installed Lazarus and some short demo project?
inserted: 2016-02-03 21:35:41   Reply...
From: johnvantelli
Lazarus fresh installed...

Version 1.4.4
rev.SVN 49931

To test the crash I create a new project, put KGrid in main form and in formCreate insert this code;

KGrid1.FixedRows := 0;
KGrid1.FixedCols := 0;
KGrid1.ColCount := 3;

KGrid1.ColWidths[0] := 200;
KGrid1.ColWidths[1] := 0;
KGrid1.ColWidths[2] := 0;

inserted: 2016-02-08 19:55:28   Reply...
From: tk
I could reproduce now, needed more moves with keyboard. The issue should be fixed, download the repo.
inserted: 2016-02-08 19:38:39   Reply...
From: tk
Cannot reproduce the bug with the same code and same fresh Lazarus on Win7x64, with all project options set to default.
inserted: 2016-01-29 05:47:33   Reply...
From: bpranoto
Hello, is it possible to:

1. Create merged header on TKDBGrid? How to do that?
2. Create column footer?

Thank you.
inserted: 2016-01-30 19:17:57   Reply...
From: tk
1. Should be possible via CellSpan but I never tested with KDBGrid.
2. Column footer (for sums etc.) is not implemented yet.
inserted: 2016-01-31 11:03:29   Reply...
From: bpranoto
Thanks, I also notice TKDBGridCol does not have title alignment property. How do we create a center aligned column title?
inserted: 2016-02-01 11:39:39   Reply...
From: tk
Each drawing customization must be done in OnDrawCell.
Here you must set Grid.CellPainter.Attributes = halCenter. See the kgrid demo how to use CellPainter.
inserted: 2016-01-26 10:15:38   Reply...
From: JanR
I have been trying out your tkpagecontrol in Lazarus, but i cannot find any way to add tabs to this control in design time. Can you tell me where I do this?
inserted: 2016-01-30 19:15:38   Reply...
From: tk
Did you try some recent download from bitbucket? There it should be already possible.
inserted: 2016-01-25 17:45:43   Reply...
From: rdevine
Hi Tomas - I've been taking a look at your very nice grid. I currently use one from TMS and for virtual mode there is an OnGetCellData event I use. I looked at the virtual grid demo for TKGrid but can't see anything similar. The demo seems to just set fixed values in the form create - am I missing something?

BTW, I had to add the "Vcl." prefix in many of the units to get it to compile in XE7.

Thanks, Bob
inserted: 2016-01-30 19:14:28   Reply...
From: tk
KGrid has different approach for virtual mode. See the kgriddemo, 3rd page. There it is shown. Btw. read the installation notes, you do only need to modify the unit scope names in your Delphi (or project) settings.
inserted: 2016-02-01 22:55:07   Reply...
From: rdevine
Thanks - always a good idea to read the installation notes :-) I see the virtual mode now - some of my datasets have millions of rows and if I set the rowcount to even 100000 it struggles. The commercial grid I use has a type of paging where only required visible cells are created, so I can set millions of rows with no performance hit. Is a similar mode available for KGrid?

Thanks again.
inserted: 2016-02-03 13:59:27   Reply...
From: tk
No, the goVirtualGrid option in KGrid just prevents creating internal cell objects, but other algorithms (such as size calculations etc.) always iterate on all rows.
inserted: 2016-01-24 00:44:00   Reply...
From: Stefan
How to Save and Load KDBGrid's Columns Order ?
KDBGrid1.Columns.SaveToFile('DBGrid.txt') - it does not work
inserted: 2016-01-30 19:12:30   Reply...
From: tk
This is not possible with KDBgrid.
inserted: 2016-01-20 20:06:31   Reply...
From: tomsan

I am using Delphi 2010 on Windows 8. The package doesn't get compiled. Most of the problems are in kFunctions.
inserted: 2016-01-21 19:29:16   Reply...
From: tk
I was testing the 1.7 on D7, DXE and DXE8. No chance for me to test versions in between, but you can always pull the repo with TortoiseHg, fix the problems and send me a patch. I think if there are some problems, they will be with the compiler conditionals in
inserted: 2016-01-21 19:32:06   Reply...
From: tk
Actually meant their application in code, where I sometimes just guessed which Delphi version implemented what.
inserted: 2016-01-09 12:51:42   Reply...
From: gerard
FYI, I just downloaded the control set from bitbucket and installed it on Laz 1.6.0rc1 under linux X64.
There is an issue when installing under Linux: it complains that it doesn't find kdialogs.pas and kgrid.pas, and it's because of the files being there but with names partially in uppercase (KDialogs.pas & KGrid.pas)
Renaming the files to kdialogs.pas and kgrid.pas solves the problem.
Best regards,
inserted: 2016-01-10 16:28:42   Reply...
From: tk
I renamed the files on bitbucket, thank you.
inserted: 2015-12-30 20:06:03   Reply...
From: lechuDC
the problem missing function makecellspan i ver 1.7
inserted: 2015-12-30 22:44:40   Reply...
From: tk
MakeCellSpan has been moved to kfunctions.pas. This is because I needed the function in KMemo as well (because of KMemo tables).
inserted: 2015-12-31 02:00:48   Reply...
From: lechuDC
thanks; need to use kfunctions.pas with kgrid
inserted: 2015-12-28 03:42:43   Reply...
From: anhnguyen18
When I add a new record in the TKdbgird, the new record always appears above the current row, it doesn't appear at the end of the TKdbgrid as a normal dbgrid. Is there anyway to make a new record which appears at the end of the TKdbgrid? Thanks.
inserted: 2015-12-30 22:39:01   Reply...
From: tk
There was a way but with more successive commands. I made the new AppendRow method from them. You can try the repo download.
inserted: 2015-12-31 03:45:08   Reply...
From: anhnguyen18
Cool! Thanks for your effort.
inserted: 2015-12-20 01:36:04   Reply...
From: snorkel
small issue with tkmemo(repos version):
tk, the memoframe has a odd issue with the text style.
basically what happens is if you have a series of chars that is
one style and put the caret in the middle of that text and then change the font for example it instead of changing just at the caret and for new typed text it changes as if you had the whole thing selected.
inserted: 2015-12-20 16:43:14   Reply...
From: tk
This is not a bug. M$ Word does it this way so I just made it the same, see TKMemoFrame.TextStyleChanged.
inserted: 2015-12-21 18:35:54   Reply...
From: snorkel
ok, I guess I never noticed that in M$ word. (I rarely use it)
I was expecting the behavior to be more in line with the simpler wordpad.
inserted: 2015-12-21 22:10:27   Reply...
From: tk
I've checked Wordpad and Libreoffice Writer. Libreoffice Writer behaves just like Word in this regard, Wordpad does not. So I think if you want Wordpad behavior you must comment out this code in TextStyleChanged:

if not SelAvail then
  // simulate MS Word behavior here
inserted: 2015-12-18 09:12:52   Reply...
From: iru
Read-only column in TKDBGrid?
How can I mark a colum read-only so that all mouse clicks and key entry (TAB?) in such a column are ignored?
inserted: 2015-12-18 09:29:40   Reply...
From: IRU
I think I have it! I read further and an answer by Calinutz does the job,
inserted: 2016-01-07 07:07:39   Reply...
From: IRU
I do not have it! I have some TKDBGrid columns (and related FireBird table columns) in which I wish to store data. How can I do it without an editor in the column? If I have to have an editor in a column how can I make the TKDBGrid readonly?
inserted: 2016-02-08 20:19:23   Reply...
From: tk
I don't understand fully what you want to achieve but a read only column can be made through a void OnEditorCreate call. This means you handle OnEditorCreate of your KGrid but do not create any editor in this handler for read only columns. I and my colleagues use this method all the time.
inserted: 2015-12-16 17:52:26   Reply...
From: snorkel
Hi tk,
quick kmemo question.
In a standard Tmemo control in the onkeydown event I can do ignore the return key and instead save the memo to a stream for sending over tcp/ip and have the return instead be shift return.
(does not work in Kmemo)

like this:
if (key = 13) and (ssShift in shift) then
key:=13 else
 if key = 13 then

inserted: 2015-12-17 14:30:54   Reply...
From: tk
This is not possible (yet). I don't know your application, but maybe you could try some workaround like form's KeyPreview or make a TAction and specify a shortcut for it? You should be also able to catch specific key and then send another key to KMemo programmatically (not tested, took from some other forum): SendMessage(KMemo1.Handle,WM_KEYDOWN,0,Integer(PChar(#13)));
inserted: 2015-12-20 01:40:52   Reply...
From: snorkel
Hi tk,
I did try changing the key in the onkeydown etc and when I send back a key it puts in a space instead of a new paragraph.
I kind of got it to work by checking if the shift key is down and the key is 13 to return a key of 0 and then add a new paragraph block.
This does not work exactly right and some odd behavior is exhibited at the caret.

If you have time, maybe as a feature request you could had a property to the control to have shift enter as the default instead of enter.
Would be super handy for chat applications.
inserted: 2015-12-20 19:00:00   Reply...
From: tk
Maybe my previous advice was wrong. Did you also play with KMemo1.ExecuteCommand(ecInsertNewLine) or KMemo1.InsertNewLine ?
inserted: 2015-12-21 18:38:14   Reply...
From: snorkel
nope I didn't try those :-)
I will try them and let you know.
inserted: 2015-12-21 18:57:00   Reply...
From: snorkel
KMemo1.ExecuteCommand(ecInsertNewLine) works, the other methods don't move the caret.

In case anyone else is interested:

in the keydown event do:

if (key=13) and (ssShift in Shift) then
end else
if key = 13 then
       //do something else like send tcp/ip message etc.

inserted: 2015-12-11 21:08:25   Reply...
From: snorkel
(KMEMO) Sorry to be a pest.. having another issue.
I am trying to insert a image/emoticon and no matter what I set the index to it always puts it on the next line, the only way I can get it to work is if I call kmemo1.blocks.clear, this then gets rid of the carriage return linefeed and then I can insert at the end of the typed text.

rve2.Select(rve2.SelectableLength, 0);

I turned on show formatting and as long as there is a CRLF symbol the block insert always goes to the next line.

If I do a blocks.clear before I do the insert it inserts where I want it, but then any new typed text the caret is off by one char.

even if I set the index for the block adds to selectablelenght it gives a index out of bounds error.

Not sure if this is a bug or I am just doing it wrong.
inserted: 2015-12-12 09:26:16   Reply...
From: tk
The AddAt(imageblk) always inserts at the end. If there is already a TKMemoParagraph block at the end then it is obvious that the image will be inserted on next line. You have to determine if TKMemoParagraph is the last block (KMemo1.Blocks[KMemo1.Blocks.Count - 1] is TKMemoParagraph) and if this expression is true then insert the image before it: KMemo1.Blocks.AddAt(imageblk, KMemo1.Blocks.Count - 2).
inserted: 2015-12-15 16:47:09   Reply...
From: Snorkel
Thanks tk,
That works except the index has to be KMemo1.Blocks.Count - 1
The block concept is pretty unique, I am getting used to it though :-)
inserted: 2015-12-16 01:42:18   Reply...
From: Tk
Yes of course, thanks for correction.
inserted: 2015-12-11 18:46:47   Reply...
From: Snorkel
Hi tk (tkmemo question),
I just noticed that the SaveRTFStream method does
not include image blocks in the saved stream.
When the stream is loaded into another kmemo the images are missing.
inserted: 2015-12-12 09:19:03   Reply...
From: tk
Maybe you are using unsupported image format?
Supported in RTF are PNG, JPG, EMF and WMF. Metafiles only on Windows.
If some png/jpg is not working, then try with KMemoDemo example, procedure LoadFiles.
Make test.rtf file.
Then comment out KMemo1.LoadFromRTF('kmemo_manual.rtf'); and uncomment KMemo1.LoadFromRTF('test.rtf');
If it does not work send the test.rtf to my email.

inserted: 2015-12-15 18:11:17   Reply...
From: snorkel
Just a FYI,
I changed my code to:

and the small emoticons are showing in the saved stream.
it does not like the image.bitmap I was using.
inserted: 2015-12-12 18:57:14   Reply...
From: Snorkel
Hi tk, I am inserting them from
A image list, they where added to
The list as bmp. I will do some more testing.
inserted: 2015-12-13 10:01:22   Reply...
From: tk
I hate TImageList implementations, both in Lazarus and Delphi they are really crappy. I don't understand, why in 2015 TImageLists do not have direct import/export functions for PNG/JPG... SVG should be supported as well now. Who uses some stupid BMP now?
inserted: 2015-12-15 16:24:42   Reply...
From: snorkel
Lazarus does allow you to export them as other formats and load other formats.
I guess the timagelist internal storage method in the DFM/LFM is tbitmap though.
I did look at the method that writes the stream/file and it did not appear to write imageblocks.
Was the imageblock export missing in kcontrols 1.7?

I actually have my project ported to Lazarus I just had to comment out a bunch of stuff that was for trichview. The only functionality I really need for the project to be fully functional is images in the stream.
inserted: 2015-12-16 01:35:27   Reply...
From: Tk
It was missing in 1.6. In 1.7 and later it was already present. But bmp is not supported as I said. I did not know Lazarus can export images from imagelist to png directly. Must have been added recently or I missed sth. Then Lazarus is better than Delphi where I've always been fighting with image lists, their correct painting and exporting of images...
inserted: 2015-12-11 05:43:47   Reply...
From: snorkel
TKmemo feature request/idea

Hi tk,
would it be possible to add a loadrtffromstream to a block object?
Then it would be possible to load a stream into a table cell like this:


I figured out how to do it by loading the RTF sent over the socket into a hidden tkmemo and then do:


inserted: 2015-12-11 15:16:39   Reply...
From: tk
See below, TKMemo.LoadFromRTFStream could have been extended to accept specific blocks as parameter.
inserted: 2015-12-11 17:27:56   Reply...
From: snorkel
Ok, I will take a look at that, I would of course prefer not to use a hidden kmemo.
Do you have a example on that?
inserted: 2015-12-13 10:17:55   Reply...
From: tk
See recent repo snapshot. I've found some time to make that change and it was not difficult. See Test24 method in KMemoDemo example for further info about how to use this.
inserted: 2015-12-20 01:33:03   Reply...
From: snorkel
tk, that change you made works perfectly. Thanks a bunch.
inserted: 2015-12-15 16:27:15   Reply...
From: snorkel
Thanks tk, will grap the repos and try it out.
inserted: 2015-12-10 20:04:04   Reply...
From: Snorkel
(Kmemo question)
Would it be possible to insert the contents of a stream into a table cell?
What I want to do id have a 3 column table and have a username in the left column, the middle column would have the RTF message from the stream and the right column would have the time the message came in.
inserted: 2015-12-11 06:38:42   Reply...
From: snorkel
I think I figured this out:
what I did was to load the stream into a hidden tkmemo.
Then I assigned the blocks from the hidden control to the cell I wanted to display the RTF that came in from the tcp/ip stream.

Don't know if that's best practice or not, seems to work fine though.
inserted: 2015-12-11 15:06:02   Reply...
From: tk
Never tried, but if it works for you then OK. Another way seems not to be supported yet, TKMemoRTFReader.LoadFromStream would need to be enhanced to accept specific TKMemoBlocks where to insert the objects from RTF.
inserted: 2015-12-09 20:04:20   Reply...
From: snorkel
Hi TK,
How can I get LoadFromRTVStream to append the stream like a log viewer or IM client would i.e. at the end of the document.

I see there is a index param and if I have that at zero it puts the newly added stream at the top. How do I get the proper index so it goes at the end?


inserted: 2015-12-09 21:41:59   Reply...
From: tk
The index -1 means adding at the end.
inserted: 2015-12-09 22:12:58   Reply...
From: snorkel
In the TKMemoRTFReader.loadFromStream:

If atIndex < 0 then
fmemo.blocks.clear; //delete everything
faactiveblocks:= fmemo.blocks
FAtIndex:= 0;

So if I set the index to -1 it replaces the contents vs adding.
inserted: 2015-12-09 22:08:30   Reply...
From: snorkel
I tired -1 and that does not append, it replaces the entire contents.
inserted: 2015-12-10 09:57:06   Reply...
From: tk
Or KMemo1.SelectableLength - 1, please test with both.
inserted: 2015-12-10 09:50:32   Reply...
From: tk
Ah I am sorry, this function works slightly different than the Blocks.AddAt function, haven't used it for a long time:-) You must then use indexes such as KMemo1.Blocks.Count - 1 or the like (don't remember exactly anymore, please test).
inserted: 2015-12-10 19:06:45   Reply...
From: Snorkel
Hi tk,
KMemo1.SelectableLength - 1 does the trick :-)
blocks.count just inserts in the first line.

I have another question though, It's adding the Richtext from the stream at the end, but it's not scrolling to the end. Is there a way to make it scroll? I know for the standard trichedit in Delphi you had to send a windows message to the controll to make it scroll.

inserted: 2015-12-11 14:34:42   Reply...
From: tk
Similar as WMVScroll does it:
Scroll(cScrollNoAction, SB_BOTTOM, 0, 0, True);

inserted: 2015-12-09 00:03:19   Reply...
From: snorkel
I was playing around with the demo editor and I am having trouble getting the font style to work like it works in other editors, for example if I click the Bold button it should apply to new text at the caret as well as selected text.
Currently in the demo with the editor frame the formatting only works on selected text.
inserted: 2015-12-09 09:46:45   Reply...
From: tk
There are still bugs there in this regard, even in the recent repo snapshot. These should be fixed soon.
inserted: 2015-12-09 18:37:18   Reply...
From: snorkel
Ok, Thanks TK.
Will be looking forward to the 1.8 release of Kcontrols.
inserted: 2015-12-08 17:31:53   Reply...
From: Stefan
how to make Coloring selected Row in a kdbgrid ?
I miss DBGrid1DrawColumnCell.
it does not work:

procedure TForm1.KDBGrid1DrawCell(Sender: TObject; ACol, ARow: Integer; R: TRect; State: TKGridDrawState);
    with TKCustomGrid(Sender) do
           if ZQuery1.FieldByName('test').AsString='YES' then

           Cell[ACol, ARow].ApplyDrawProperties;
           CellPainter.GraphicHPadding := 3;
inserted: 2015-12-09 09:44:15   Reply...
From: tk
You must use: KDBGrid1.CellPainter.Canvas.Font.Color := clRed;
inserted: 2015-12-09 18:07:17   Reply...
From: Stefan
it does not work:<br> if 1 row is Yes, everything is red.

 procedure TForm1.KDBGrid1DrawCell(Sender: TObject; ACol, ARow: Integer; R: TRect; State: TKGridDrawState);
 with TKCustomGrid(Sender) do
 begin if ZQuery1.FieldByName('test').AsString='YES' then KDBGrid1.CellPainter.Canvas.Font.Color := clRed;; Cell[ACol, ARow].ApplyDrawProperties; CellPainter.GraphicHPadding := 3; CellPainter.DefaultDraw; end; end;
inserted: 2015-12-09 22:05:51   Reply...
From: tk
I didn't notice you reversed the function calls. First you should call ApplyDrawProperties to apply cell's drawing styles to the CellPainter (if any) and then you can modify the CellPainter with your custom statements. The CellPainter's font (which is actually used to paint the cell text) is always reset to grid's font before each cell is drawn (see TKGridCellPainter.DefaultAttributes) so if everything is red then your condition clearly evaluates True for each cell.
inserted: 2015-12-10 18:46:52   Reply...
From: Stefan
Thank you for your answer.
But I do not know how to do it.
Can you give an example.
inserted: 2015-12-20 19:54:15   Reply...
From: tk
Works for me wo problems:
with TKCustomGrid(Sender) do
  Cell[ACol, ARow].ApplyDrawProperties;
  CellPainter.GraphicHPadding := 3;
  if ARow = 3 then
    CellPainter.Canvas.Font.Color := clBlue;
inserted: 2015-12-04 11:06:03   Reply...
From: jim
can't install in XE6 !! which steps to follow ??
inserted: 2015-12-07 09:32:43   Reply...
From: tk
It depends on what is the problem, please specify. You should follow installation notes in kcontrols_readme.txt and you should be able to install the packages.
inserted: 2015-12-17 13:12:53   Reply...
From: jim
compile packages -> can't find : controls, forms, graphics etc
library path set ....
inserted: 2015-12-18 22:51:59   Reply...
From: tk
You must add Vcl and Vcl.Imaging to Unit Scope Names, it is described in kcontrols_readme.
inserted: 2015-11-27 23:39:10   Reply...
From: JD
How can I have rows with alternate colors? It makes large grids easier to read.

inserted: 2015-12-07 09:33:20   Reply...
From: tk
No, you must paint yourself in OnDrawCell.
inserted: 2015-12-23 12:52:33   Reply...
From: JD
Thanks a lot for your advice. I've done it & it now works.
inserted: 2015-11-24 23:06:55   Reply...
From: JD
Thanks for your wonderful work tk. Is it possible to export the contents of the TKGrid directly to an Excel and/or CSV file?
inserted: 2015-11-25 10:57:55   Reply...
From: tk
Export to Excel xls(x) is rather tricky but export to CSV should be very simple. I obviously iterate all rows and use TStringList's Delimiter and DelimitedText properties. The code is short and simple. It is not implemented directly in KGrid because I obviously need more data in resulting CSV than just the data from the grid and use always custom functions for that. But maybe in some next commits I'll implement at least basic import/export methods to CSV.
inserted: 2015-11-25 11:46:50   Reply...
From: JD
OK thanks. Looking forward to your modifications.
inserted: 2015-11-14 19:21:24   Reply...
From: Dibo
TKGrid - is it possible to have null selection? I mean, no row or cell selected. For example, I have form with list. Each click on row will start some time consuming method. The problem is that TKGrid (or even lazarus grids) always have selection on start. So far I'm using TListView which can have ItemIndex := -1 so user know that he must select something
inserted: 2015-11-15 14:02:10   Reply...
From: tk
Grids obviously have always selection and KGrid is not exception in this regard. You can still override this behavior by custom painting and custom implementation of cell selections (events OnMouseClickCell, OnKeyDown and OnDrawCell). But unless you need it for some specific reason, I would stay at TListView.
inserted: 2015-11-14 04:42:32   Reply...
From: User757
Is it possible to hide the memo's caret?

Especially when ReadOnly, it could be a good thing in some situations to hide the blinking caret.
inserted: 2015-11-22 10:24:29   Reply...
From: tk
See eoDisableCaret option in the repo (commit #df0d838).
inserted: 2015-11-22 19:20:19   Reply...
From: User757

The *.lrs files for Lazarus are not present in the repo, but I copied them from the KControls 1.7 release pack.
inserted: 2015-11-22 20:13:06   Reply...
From: tk
Altough they can be generated with kcontrols_laz.bat which was there already, I've added them to the repo for easy access. The same for corresponding *.res files for Delphi.
inserted: 2015-11-16 23:25:29   Reply...
From: tk
Not yet - is our todo.
inserted: 2015-11-11 17:20:06   Reply...
From: tony
When I insert a small icon for a emoticon it does not advance the caret.
it also moves the icon to the next line instead of at the end in some cases.
For example if I type "This is a test" the inserted emoticon goes to the next line. If I insert that emoticon, then start typing after it on the next line it puts the graphic at the end but does not advance the caret to the position after the small emoticon image.
Is there a way to do what I want? or is this a issue with the beta control?

Keep up the great work, this is the only real alternative I have seen to Trichview.
inserted: 2015-11-22 19:44:39   Reply...
From: tk
See my answers to snorkel.
inserted: 2015-11-10 08:00:51   Reply...
From: snorkel
Tkmemo looks great. Been looking for a trichview replacement so I can port a app to lazarus, this looks like it might work.
Great work on this.

Will be following how it works on lazarus. Will the saveRTVStream also save any insert controls like buttons? Also will inserted controls that have embedded binary i.e. tbitbutton for the glyph stream properly over tcp/ip using someting like Synapse or Indy?

What I do with trichview is create a button control that can store a small binary wav in the control, then stream that and the user on the other side can click the button and it plays the embedded sound.
inserted: 2015-11-11 10:51:04   Reply...
From: tk
Although this control has already many features and we use it on many places in our last project it is still beta state. Some important things are still missing. See the kmemo readme for details. Form elements (like buttons, edits, check boxes) are neither supported nor even mentioned there. TRichView has many years development and KMemo is only few months old. So if you need them now KMemo does not support this yet. Of course there is always possible for you to add these features to KMemo yourself (as you have full source available) but I would strongly discourage you to do it unless you are very good programmer and familiar with all the RTF pitfalls. The most important thing about RTF is to maintain compatibility with Microsoft products and it is not always easy and understandable from the RTF specification how to do that. Embedded objects is a shining example of such comlexity.
inserted: 2015-11-11 17:25:11   Reply...
From: Snorkel
Thanks for the reply.
For me to port my app to lazarus I really only need images to be saved to the stream. Controls are just extra things.

Is it possible to insert a small emoticon image and have the caret advance to a position after the image? What I want to do is type some text say: "this is a test" then insert a small smiley emoticon and then continue typing. I could not get it to work right with the position set to text.
Anyways nice job.
inserted: 2015-11-11 18:25:00   Reply...
From: tk
This should be possible but I don't know what you exactly mean. If you mean inserting emoticon glyph by code and then move caret see one of my comments below regarding TKMemoImageBlock. You can then move caret programmatically with Select method. E.g. if you want caret have at the end after image insertion use this: KMemo1.Select(KMemo1.SelectableLength, 0);
inserted: 2015-11-10 07:19:56   Reply...
From: snorkel
This is very nice. I have a chat application built with trichview in Delphi and I have been looking for a replacement control that works similar to it that I can use on Lazarus.

If you add controls can they also be saved to a stream and sent across the wire with TCP/IP?

Also how do you add tabs to your tpagecontrol?

inserted: 2015-11-16 23:26:54   Reply...
From: tk
KPageControl already supports design time commands, will be part of next update.
inserted: 2015-11-10 07:14:38   Reply...
From: snorkel
very cool. How do you add a click event to the URL insert?
inserted: 2015-11-16 23:28:40   Reply...
From: tk
KMemo has already been extented - TKMemoHyperlink already has OnClick, OnDblClick, is excellent for making read-only welcome screens etc., will be part of next update.
inserted: 2015-11-21 07:02:57   Reply...
From: Snorkel
Thanks, looking forward to the update.
inserted: 2015-10-23 11:03:12   Reply...
From: littleearth
Hi I have a modified version for Delphi Seattle if you would like the Package files.
inserted: 2015-10-26 13:57:43   Reply...
From: tk
Please send them to tk(at) Thank you.
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

Grouping of comments

by: tk



by: tk


My recent work on KMemo

by: tk


Update for RAD Studio XE2

by: tk


Slow progress

by: tk