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

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 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. 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.74362Delphi 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.62607Delphi 6+,Lazarus 1.2.2+, C++Builder 2007+support for RAD Studio XE6, Columns property in TKDBGrid, bugfixes...
kcontrols_1.5.zip1.5336Delphi 6+,Lazarus 1.2.2+, C++Builder 2007+new components TKMemo, TKBitBtn, TKColorButton, some bugfixes...
kcontrols_1.4.zip1.4977Delphi 6+, Lazarus 0.9.29(SVN#21827)+, C++Builder 2007+support for RAD Studio XE3-XE5, new components etc.
kcontrols_1.3.zip1.32704Delphi 6+, Lazarus 0.9.29(SVN#21827)+, C++Builder 2007+support for RAD Studio XE2
kcontrols_1.2.zip1.23072Delphi 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.11082Delphi 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.01677Delphi 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-12-01 10:47:50   Reply...
From: СМ630
There is a bug in the hyperlink handling: when the mouse is over a hyperlink and Ctrl+LeftMouseButton is pressed the mouse icon is NOT changed to a hand.
When still holding Ctrl+LeftMouseButton and moving the mouse a little the mouse icon is changed to hand, as expected.
inserted: 2016-12-02 11:49:09   Reply...
From: tk
I am not able to reproduce this.
inserted: 2016-11-22 09:52:51   Reply...
From: СМ
Hi Tk,
I have two other issues:
1. I am trying to add a multiline text in a table in TKMemo:
But the CrLf gets removed text is not printed on a new line. Should I use some other line separator?

2. I run the following code:
  for TSIndex :=0 to tbl.RowCount -1 do
My idea is to have a minimum height of the (empty) rows.
But after I run the code, the size of the rows is zero. Am I missing something?
inserted: 2016-11-24 10:22:41   Reply...
From: СМ
Hi Tk,
I could not find a way to find add formatted RTF text directly.
I tried
   kmMain.Blocks.Text :=('{\field{\*\fldinst HYPERLINK ""}{\fldrslt}}');
   kmMain.Blocks.AddTextBlock ('{\field{\*\fldinst HYPERLINK ""}{\fldrslt}}');
but none of them was displayed as a hyperlink.
inserted: 2016-11-24 12:16:50   Reply...
From: СМ
I have come across MyMemo.RTF.
  KMemo1.RTF:='{\field{\*\fldinst HYPERLINK ""}{\fldrslt}}';
  KMemo1.RTF:='{\field{\*\fldinst HYPERLINK ""}{\fldrslt}}';


  KMemo1.RTF:='{\field{\*\fldinst HYPERLINK ""}{\fldrslt}}';
  KMemo1.RTF:='{\field{\*\fldinst HYPERLINK ""}{\fldrslt}}';


(the 123 goes in the end, instean between the hyperlinks)
inserted: 2016-11-25 00:36:36   Reply...
From: tk
Hmm, I could see now that things were broken in the trunk. Setting RTF property should clear previous content (just like LoadFromRTF) and it did not.

Moreover, new RTF content was not added to the end with LoadFromRTFStream(Stream, -1) but to the beginning.

I quickly fixed this but definitely we need some unit testing for KControls...
inserted: 2016-11-25 00:02:13   Reply...
From: tk
Writing this from memory (have not tried):
a. You should assign only complete RTF document to RTF property {\rtf1\ansi...}.
b. Try to create a simple document with one hyperlink with KMemoEditor and save it. Then copy the content of the saved file to clipboard and paste it to your code. It should work.
inserted: 2016-11-25 11:40:37   Reply...
From: СМ
Thanks for the info.
The way I understand you:
I cannot add multiple RTF blocks. It seems to make sense, sinces colour, styles, etc are coded in the head of the RTF.
My idea was to convert HTML hyperlinks to RTF ones, which is much easier than parsing the HTML content and extracting them. I will think what to do form now on.
inserted: 2016-11-25 13:32:07   Reply...
From: tk
You can add more RTF chunks. It is actually what Paste does. Only the property RTF should not. For adding this, use LoadFromRTFStream. Maybe AddRTF or similar could be added to simplify that.

The RTF chunks you will add using LoadFromRTFStream should begin with '{rtf1...'. Current implementation might not require this but for future it is safer. If the new RTF chunks don't define new colors, fonts, lists etc. never mind, default values valid for the actual document will be taken.
inserted: 2016-11-30 08:01:08   Reply...
From: СМ
Hi Tk, I just tried this:

procedure TForm1.Button1Click(Sender: TObject);
  MyStream: tstream;
  MyStream := TStringStream.Create('{\field{\*\fldinst HYPERLINK ""}{\fldrslt}}');
  KMemo1.Blocks.LoadFromRTFStream (MyStream);

  MyStream := TStringStream.Create('{\field{\*\fldinst HYPERLINK ""}{\fldrslt}}');
  KMemo1.Blocks.LoadFromRTFStream (MyStream);

When I execute it, I get
„http://www.google1.com‟ (the second last is displayed first and no new paragraph was added). I tried to use different values of AtIndex but result was always the same.
inserted: 2016-11-30 11:34:02   Reply...
From: tk
Works for me fine with the latest commit.
inserted: 2016-11-30 12:05:12   Reply...
From: СМ
Thanks, I tried it with the latest commit.
It seems to work fine, except in caes when the table is newly created- there is a empty paragraph in the top of the table.

For example:
procedure TForm1.Button1Click(Sender: TObject);
  MyStream: tstream;
  MyStream := TStringStream.Create('{\field{\*\fldinst HYPERLINK ""}{\fldrslt}}');
  KMemo1.Blocks.LoadFromRTFStream (MyStream);

leaves an empty line in the top of the KMEMO. On next executions no empty lines are added, as expected.
inserted: 2016-11-30 15:32:06   Reply...
From: tk
LoadFromStream with default AtIndex parameter adds the stream content after all existing blocks.

Blocks in empty memo (or memo container such as table cell) have (or should have) one paragraph inserted, for misc. reasons.

So you must call x.Blocks.Clear before calling LoadFromStream.

inserted: 2016-12-01 07:22:03   Reply...
From: СМ
Seems flawless now!
I think there are some other cases, when I had trouble with the leading paragraph, I believe they will be solved now.
inserted: 2016-11-23 09:08:40   Reply...
From: tk
Not tried but this should work:
1. Use Blocks.Text := YourContent;
2. Use tbl.Rows[RowIndex].RequiredHeight := YourHeight;
inserted: 2016-11-23 11:22:25   Reply...
From: СМ
Thanks, actually
Blocks.Text := YourContent; fixed both cases.
inserted: 2016-11-22 02:59:05   Reply...
From: PascalDude
First off, thank you for these components. The cross-platform aspect is fantastic!

As I begin to use them I have a few questions. This one regards the TKLinkLabel component.

At design-time setting the Font|Color property always reverts to clBlue, and at run-time the color is Blue but when the mouse passes over it then it changes and remains at the Link Color value. How can this be fixed?
inserted: 2016-11-23 09:12:52   Reply...
From: tk
There was bug, I fixed it in the trunk. It appears I've always used blue labels so far...
inserted: 2016-11-21 11:53:41   Reply...
From: СМ
Hi Tk,
I am running the following code:

  TBL.CellStyle.BorderWidth := 1;
  TBL.ColCount := 6;
  TBL.RowCount :=150; // or 300 or 600 or 1200;

It occurs that execution time is as follows:
For TBL.RowCount :=150; = 1,5 s
For TBL.RowCount :=300; = 5,5 s
For TBL.RowCount :=600; = 27 s
For TBL.RowCount :=1200; = 109 s

I did some digging trought the code and I found out that Changed is executed in
procedure TKRect.SetBottom(const Value: Integer);
procedure TKRect.SetTop(const Value: Integer);
procedure TKRect.SetLeft(const Value: Integer);
procedure TKRect.SetRight(const Value: Integer);

I commented all the occurences of Changed in the aforemenetioned procedures, leaving only one FixupBorders in the end of procedure TKMemoTable.ApplyDefaultCellStyle;

This way execution time decreased from 109 000 ms to only 46 ms.
Possibly you could introduce some changes in the code, in order not to execute Changed when ApplyDefaultCellStyle is performed?
inserted: 2016-11-21 17:52:19   Reply...
From: tk
I see it now, is a bug, table updating should be locked inside of those methods. I added the missing locks.
You could lock the table explicitly in your code and it was the same.

Despite this locking reasonable amount is about 1000 rows with simple text. When more KMemo already begins to struggle when modifying, moving&resizing.
inserted: 2016-11-21 17:01:07   Reply...
From: tk
Did you lock your table using LockUpdate/Unlockupdate?
inserted: 2016-11-22 07:49:19   Reply...
From: СМ
Thanks, it works a way faster now!
I have not locked the table, before trying the aforementioned case (because I had no idea that I should), but I tried to do it and it work much-much faster now.
But is not the concept of LockUpdate to prevent changes from manual input from the user? If so, should not it be autoenabled, when the KMemo is ReadOnly?
inserted: 2016-11-23 09:24:25   Reply...
From: tk
With KControls, LockUpdate/UnlockUpdate pairs should always inhibit control updating when more changes are made (more properties set at a time). For old controls like KHexEditor it might not be the case yet, because I introduced this later.

With KMemo, I don't know what you exactly mean, ReadOnly should alone prevent changes from user.

One of the todos with KMemo is to further optimize the MeasureExtent chain, to make it faster. Eg. there is no need to re-measure blocks/containers where nothing has changed.
inserted: 2016-11-20 19:10:02   Reply...
From: PascalDude
How to Add/Delete a Page in the TKPageControl? Using Delphi2007 and not seeing a New Page/Delete Page when I right-click on the control.

Thanks in advance.
inserted: 2016-11-21 16:59:19   Reply...
From: tk
It has been added in the trunk, download from bitbucket.
However, it does not work good in Lazarus yet.
inserted: 2016-11-22 22:14:51   Reply...
From: PascalDude
Thank you. I shall download and use.
inserted: 2016-11-21 14:45:42   Reply...
From: СМ
Hi, I found no way to add in the IDE, but you can add during runtime:
  KPageControl1.Pages[0].Caption:='Page 0';
  KPageControl1.Pages[1].Caption:='Page 1';

inserted: 2016-11-22 02:56:16   Reply...
From: PascalDude
Thank you for the prompt reply.

This means it is a run-time component then? And, a way to use this would be to create forms and set the respective Page as it's Parent? Correct?

I also have another question on the TKlinkLabel. Shall submit as a separate post.

inserted: 2016-11-15 14:37:27   Reply...
From: СМ
Hi Tk,
I am beating my head how to set the background of a single cell.
There is no example like this inthe manual.
Whatever I try, it either does nothing or crashes the app.
Could you help me with that?
inserted: 2016-11-16 14:06:22   Reply...
From: tk
For example:
Table.Rows[0].Cells[0].BlockStyle.Brush.Color := YourColor;

Table is of type TKMemoTable, must be created and must have at least one row and one column.
inserted: 2016-11-17 09:05:13   Reply...
From: СМ
Thanks, it works just fine!
inserted: 2016-11-14 12:26:52   Reply...
From: СМ
Hi Tk,
Thanks for the great component!
Could you consider adding OnClick and OnMouseOver events for the Hyperlinks in the KMemo?
This would increase the application of HyperLinks greatly.
inserted: 2016-11-16 13:46:56   Reply...
From: tk
OnClick has been already added, download the trunk. OnMouseOver not yet but I'll add it.
inserted: 2016-11-17 10:08:47   Reply...
From: СМ
Hi Tk,
I am not sure that you undertsood me right.
My idea was about event when a HYPERLINK is pointed or clicked.

The wider idea is:
   When a hyperlink is Pointed, Clicked or Double Clicked to generate an event and to write the address (URL) in a variable of the TKMEMO itself.
   This way the developer will be able to choose what to do when a hiperlink is pointed or clicked (for example: open link in an external browser/ editor; open in internal browser; choose a key to be pressed together with the mouse button, open a popup menu, etc.). For example when the TMEMO is read-only it would make more sense to open links with a single click, than with click+key.
I tried to implement this myself, but the event has to be owned by TKCustomMemo, and it has to be fired from within TKMemoHyperlink.WordMouseAction.
I got some troubles accessing TKCustomMemo from within TKMemoHyperlink.WordMouseAction which I have not solved yet.
inserted: 2016-11-18 00:40:59   Reply...
From: tk
Yes but that's what we use already about a half a year. But it is not implemented in the official 1.7 release but in the trunk on bitbucket.

Just simply use:

  HY: TKMemoHyperlink;
  HY := KMemo1.Blocks.AddHyperlink(HyperLinkCaption, '');
  HY.OnClick := MyClickCommand;

When read only, no Ctrl key needs to be held down to call OnClick.
inserted: 2016-11-18 09:01:09   Reply...
From: СМ
Thanks for the example.
The positive side of this approach is that a custom activity per every single hyperlink.
But the negative side is that when a RTF is loaded from a file (or a simply when RTF formatted strings are added), such activities cannot be done.

Also, would you mind if I copy kgrid_manual.rtf to This way me and others wouyld be able to contribute to the knowledge base?
inserted: 2016-11-18 13:58:33   Reply...
From: tk
I/we use the TKMemoHyperLink.Onclick only for a document built in code. Basically our case is a welcome screen for a program, with links to offline and online help, sample projects etc.

But even in case you load the content from RTF you can loop over the blocks and look for hyperlinks. If found then assign OnClick for them.

Here I perhaps understand you. Easier it would be to assign a global TKMemo.OnBlockClick, check for a hyperlink there and perform specific action. That way you could skip the block search.
I'll see what I can do.

Of course you can copy the manual(s) to lazarus wiki.
inserted: 2016-11-18 15:21:52   Reply...
From: СМ
As you wrote:
„...check for a hyperlink there...‟ I am not sure what you meant by „check for a hyperlink there‟ but I suppose the an easy to use solution would be to provide a property (for example) HyperlinkPointed: string...
When the OnClick/MouseOver... etc. event occurs, it would contain the name of the pointed hyperlink. Otherwise it could be empty (thought it might better not be).
inserted: 2016-11-19 12:46:13   Reply...
From: tk
I added global OnBlockClick and OnBlockDblClick events, pull the changes from trunk.

To filter hyperlinks use 'if Block is TKMemoHyperlink' as I already said.

To inhibit default behavior just set Result := True in the OnBlock(Dbl)Click handler.
For hyperlink just set Result := True in OnBlockClick. This will inhibit opening assigned URL in the browser.
inserted: 2016-11-18 17:01:46   Reply...
From: tk
You would get a Block parameter in the OnBlockClick which would be the sending block. Then you just test

if Block is TKMemoHyperlink then

inserted: 2016-11-25 14:33:05   Reply...
From: СМ
I tried these and they work.
What I still cannot do is to find out the text block under the mouse cursor (i.e. the focused block). Ther is ActiveBlock and Selected block, but none of them is the one under the mouse pointer.
This would be useful for:
  1. Handling OhMouseOver (MouseOverHyperlink) events.
  2. Popup menus (displaying the links in them, copying Hyperlink address, etc.)
   Could you tell me if there is a ready solution for that?

If I get it right function TKMemoBlocks.MouseAction... searches all the contents to find out which is the pointed block, but it does not return the resulting block.
This way coders would have to rerun the same search, in order to find the pointed block.
inserted: 2016-11-08 00:24:12   Reply...
From: Froggy
Hi tk, great tools but noticed a bug in kmemo maybe?

when using SelStart property it seems only return valid position for first line, when other lines exist do we need to use SelStart with some other property?

For example:

This is a line 1
This is a line 2
This is a line 3

How to move caret (SelStart) to the word "is" on the second line?
inserted: 2016-11-08 21:14:46   Reply...
From: tk
Caret is always placed at TKMemo.SelEnd (visible when TKMemo.SelLength = 0).

To move caret use TKMemo.Select.

In this case easiest will be to count the characters(here it should be 22) and move the caret:

KMemo1.Select(22, 0);

The indexes are relative to TKMemo.ActiveBlocks.
Thus, if you have a container (embedded text box) in your document and it is active then these indexes are relative to its contents.
inserted: 2016-11-08 12:51:44   Reply...
From: Homer
This cannot be bug, Kmemo returns the caret position using SelStart the same way TMemo does, it counts all previous characters from previous lines to return character index.

maybe what you want is to return selstart starting from 0 for each line? maybe there built in function for that.
inserted: 2016-11-08 10:20:54   Reply...
From: Homer
Not tried but Maybe RealSelStart can help you?
inserted: 2016-11-05 23:37:12   Reply...
From: Homer
in kMemo how can you change the text style of words without manually selecting text but by defining a range? eg in lazarus, 3rd party control RichMemo you can use RichMemo1.SetRangeParams(), how to do similar in Kmemo? Thanks
inserted: 2016-11-07 19:59:08   Reply...
From: tk
KMemo has/must have very different approach than Delphi/Lazarus Richedit/Richmemo since it also supports complex things like tables, embedded containers, is ready to support controls in the future etc. There is no RichEdit/RichMemo compatibility layer. Also please note KMemo is still beta - not finished. Contributions are welcome!

1. SetRangeParams (or similar) not supported now - only way now is to select text, call SelectionTextStyle property and deselect text, see TKMemoFrame.TextStyleChanged.

2. Searching for text/highlighting - this is rather special thing, not easily doable in Kmemo now, no text search implemented yet etc.

3. Blocks are not confusing. It is IMO the only viable approach for a complex rich edit document, as said above. But I admit, some text oriented helper methods are still missing.

4. Current line can be easily obtained through IndexToLine, eg.:
LineIndex := KMemo1.Blocks.IndexToLine(KMemo1.SelEnd);
inserted: 2016-11-07 21:10:22   Reply...
From: Homer
Forgot to mention i think richmemo setrangeparam internally begins line update , selects text and change format style and then ends the line updates. Similar procedure should not be so difficult to impelement in Kmemo.
inserted: 2016-11-07 23:12:52   Reply...
From: tk
Actually it should be easy to adapt. Just call the code of SelectionTextStyle with custom SelStart and SelEnd arguments...
Will try tomorrow.
inserted: 2016-11-07 23:28:42   Reply...
From: Homer
Ok but this matter is not of great urgency. In mean time i will try to use and understand control more better as the syntax is much different to usual controls.
inserted: 2016-11-18 01:09:18   Reply...
From: tk
Made SetRangeParaStyle and SetRangeTextStyle. Tested in KMemoFrame, worked fine for me.
inserted: 2016-11-07 21:02:44   Reply...
From: Homer
Ok thanks for help, controls provided are wonderful addition and can become great but also confusing for first time user, difficult when always using lines and strings, blocks sound really powerful but confusing, text helpers are greatly needed because it should not be so tricky finding things like the caret.x and caret.y, current line and things etc.

How to get current line text though?

Form4.Caption := KMemo1.Blocks[KMemo1.Blocks.IndexToLine(KMemo1.SelEnd)].Text;
inserted: 2016-11-07 21:51:47   Reply...
From: Homer
Never mind found KMemo1.Blocks.LineText[Line] :)
inserted: 2016-11-07 23:31:17   Reply...
From: tk
You see I forgot this property.

Don't know what exactly you want to do with this but you have to ensure there is only text (and not images etc.) on the line where you want to find some text occurences eg. with Pos function. Otherwise the indexes returned by Pos won't match the actual letter indexes in the document!

That's why a more sophisticated (generous) way of finding text occurences in the document (or part of it) is necessary. Because text blocks can contain whole sentences as well as only a single letter (if it has different text style) and these blocks can even be nested, it is not trivial task to implement this.
inserted: 2016-11-06 20:28:08   Reply...
From: Homer
  CurLine: Integer;
  CurLine := KMemo1.ActiveBlocks.LineInfo[KMemo1.CaretPos].StartIndex; ??
inserted: 2016-11-06 17:41:42   Reply...
From: Homer
How do you even get all the text on the current line, how to even know the current line? RichEdit1.Lines[RichEdit1.CaretPos.Y] but nothing simlar on kmemo? blocks, activeblocks its all confusing!
inserted: 2016-11-06 14:05:43   Reply...
From: Homer
How do you even get current line index, blocks are confusing? Need to get all text typed on current line and highlight words ("user") in different style but kmemo is confusing control to use and no real documentation?

Please help thanks.
inserted: 2016-10-03 23:24:28   Reply...
From: anor
thanks you very much for the hexeditor, i need it for a some fast tool, thanks!
inserted: 2016-10-03 19:30:37   Reply...
From: leospb
Cannot compile: [dcc32 Error] kedits.pas(708): E2010 Incompatibie types: 'SmallInt' and 'Integer'


Can you help, please?
inserted: 2016-10-08 19:24:13   Reply...
From: tk
Go to function TKNumberEdit.UpDownChangingEx and modify its header from {$IFDEF COMPILER17_UP} to {$IFDEF COMPILER18_UP}. Because I did not use XE4 I just guessed in which Delphi version the change was made. I'll fix this in the repo as well (in the repo somebody renumbered the COMPILERxx_UP conditionals, I don't recall anymore why).
inserted: 2016-09-06 22:07:35   Reply...
From: krzynio
Lazarus 1.7 (svn 52880M) GTK2 FPC3.0.0
Cannot compile: kmemortf.pas(4030,10) Error: Identifier not found "UTF8Copy"
Can you help, please?
inserted: 2016-09-20 09:36:45   Reply...
From: tk
Ok, you can use my today's commit, it should compile fine with your 1.7. I've replaced the obsolete UTF8 functions from LCLProc with equivalents from LazUTF8. The UTF8 functions were not removed from LCLProc yet, but apparently will be in the future. See
inserted: 2016-09-07 21:48:57   Reply...
From: tk
I don't have this version (been using the official 1.6) but someone probably removed the function from LCLProc.pas. It was marked as deprecated. Changes in KControls will be made first when it does not compile with the official stable release.

Solutions for now:
1) Either use a Lazarus version which has the function.
2) Or take the missing functions from previous versions of LCLProc.pas.
3) Or file a bug report and demand the obsolete functions to be returned to LCLProc.pas.
inserted: 2016-08-25 13:59:45   Reply...
From: inform
we just start to use KGrid and it works good for us. We use it as a replacement for TDrawGrid.

During the replacement process we found some points to enhance the compatibility with VCL and we have an suggestion about an enhancement (including source).

Is there any way to contact you directly by E-Mail?
inserted: 2016-08-30 21:11:01   Reply...
From: tk
Did you send the email? I am asking because I experienced some problems with this email account few days ago. Now it seems to work fine.
inserted: 2016-08-25 15:33:44   Reply...
From: tk
Yes use the email you see in the source headers.
inserted: 2016-07-11 18:22:10   Reply...
From: HexUser

I see that there are exactly the first 25 MB loaded.
It happens both with x86 and x86_64 compiler in Lazarus 1.6.0
inserted: 2016-07-19 18:57:26   Reply...
From: tk
With my new commit even files > 4GB should open fine (when compiled with 64-bit compiler). Tried with 64-bit Lazarus. However, the editor has no paging mechanism. Loading & saving is very slow and working with the file is not very fast either.
inserted: 2016-07-18 13:53:36   Reply...
From: tk
KHexEditor is not ready to open big files. Although I am able to open files as large as you mention (when compiled with 64-bit compiler) there is unpredictable behavior due to miscellaneous arithmetic overflows. The reason for these are the Integer/Cardinal types used everywhere in the control, which are always 32 bit wide.

The control would need some work to handle big files correctly.
inserted: 2016-07-11 18:15:19   Reply...
From: HexUser
I have a Problem, when I load large Files in the KHexEditor.

The example-file with 4.02 GB normaly ends at
0x101993FF9, but in the Hex View only a first part until
0x001993FF0 is loaded.

Is this a known Issue? Is there a fix or workaround?
inserted: 2016-06-14 06:33:29   Reply...
From: RobV
Hi Tk,

How I get the exact position or rect of an container (table) ?

when I evaluate two tables the second seems to display corresponding to the correct position:

  for I := 0 to LineCount - 1 do
        J := FLines[I].StartBlock;
        Item := Items[J];
        if item is TKMemoContainer then begin
          x:=TKMemoContainer(item).BoundsRect.Bottom ;


inserted: 2016-06-14 06:39:31   Reply...
From: RobV
sorry .. the observation that wanted to do is

...the position of a second table on the same page appears not correspond to its correct position.
inserted: 2016-06-15 14:05:44   Reply...
From: tk
Well I don't understand this either, has it sth. to do with the print&preview issues which we've discussed below? If yes you might try the current repo download. For tables, I made page breaks to ensure table rows will be shown on next page if they don't fit to current page.
inserted: 2016-06-15 17:33:20   Reply...
From: RobV

hi tk,

I found that this latest version you fixed the texts that were not being displayed correctly when the page change.

But in the example file
 the text after the second table is not displayed neither the first nor the second page. For you to evaluate this inconsistency this file must be loaded in the example of the program KMemoEditorLaz.

inserted: 2016-06-15 21:34:25   Reply...
From: tk
Hmm, you're right! Still bugs there in TKMemoBlocks.GetPageCount and GetPageData. I'll fix them tomorrow.
inserted: 2016-06-15 17:48:21   Reply...
From: RobV


inserted: 2016-06-15 21:54:51   Reply...
From: tk
Btw. the font in the document seems to be invalid. Lazarus LCL clearly understands the font name 'default' but Delphi VCL does not. And Word does not either. How did you get this font there?
inserted: 2016-06-16 13:02:21   Reply...
From: RobV
the texts off the table were produced by typing in your sample program "KMemoEditorLaz" (propertie font=Tahoma DEFAULT_CHARSET size 8)
compiled in lazarus 1.6 windows 10 pro version 64bits. The two tables have been copied with clipboard from example 13 "KMemoDemo.exe"
inserted: 2016-06-16 13:05:24   Reply...
From: RobV
the file "teste.rtf" was saved using kMemoEditorLaz.
inserted: 2016-06-16 13:30:44   Reply...
From: RobV
the problem of supply becomes evident when you begin to suspect the copy to kmemo clipboard which is another problem or bug even be repaired.
The reported issue is about texts or tables that should go out on the next page and are not displayed because of the two routines that you have mentioned.
the problem remains in other examples see
inserted: 2016-06-17 01:13:44   Reply...
From: RobV
with commit e44a8bcdfc4a this works fine.

inserted: 2016-06-12 09:47:43   Reply...
From: Whisper
I select a grid: N-col and M-row. How I can mark all grids of the same row? I've tried differents methods without any success. Any help code?

Thanks in advanced
inserted: 2016-06-13 20:22:29   Reply...
From: tk
Don't understand, please specify exactly what you want to do.
inserted: 2016-06-14 16:56:01   Reply...
From: Whisper
Hi tk!
For example. I have this kgrid (picture 1)
The position of cursor/mouse is inside of the grid with "light grey" color (picture 1 and 2). I would like that all grids, in the same row, where the mouse is, are in the same "light grey" color (picture 3).

I check the first checkbox (picture 4), and then, it should be mark the rest of checkboxes of first col.

picture 1->

Thanks for your interest
inserted: 2016-06-15 10:46:20   Reply...
From: tk
To select entire line use goRowSelect, like in normal Tstringgrid.
To show all checkboxes checked or unchecked according to some condition you need some custom code in OnDrawCell. Here to draw the checkboxes in checked/unchecked state according to the first checkbox state. Use property TKGridCellPainter.CheckboxChecked for this. Then, you would need to call TKGrid.InvalidateCol when the first checkbox state is clicked and this will redraw entire column.
inserted: 2016-06-17 09:47:34   Reply...
From: Whisper
Thanks for your tips. I've fixed the ISSUES!!

inserted: 2016-06-12 03:42:02   Reply...
From: abdel
Hi tk.
many thanks for your great work!!! Can you add support for Arabic language to kmemo please...
inserted: 2016-06-13 20:21:13   Reply...
From: tk
Well, it is hard to make sth I don't understand. Maybe some Arabic speaking contributor could...
inserted: 2016-06-06 18:14:02   Reply...
From: RobV
hi tk,

this function
function RectInRect(Bounds, Rect: TRect): Boolean;
  Result :=
    (Rect.Left < Bounds.Right) and (Rect.Right >= Bounds.Left) and
    (Rect.Top < Bounds.Bottom) and (Rect.Bottom >= Bounds.Top);

was produced to check if the rect rectangle is within (or is internal to) the bounds rectangle or has another meaning?

(I question this because geometrically the
Rect.Bottom> Bounds.Bottom is not true)


inserted: 2016-06-06 22:13:03   Reply...
From: tk
There are two similar functions in KFunctions.pas. The function RectInRectFully probably does what you need. I remember only I needed both.
inserted: 2016-06-05 17:54:23   Reply...
From: RobV
I downloaded the bitbucket the latest version after your last commit 795e924
and I made the following adjustments and incorporated in the latter commits

I create only more one variable "isPrinting" incorporated into the object
TKPrintPageSetup and added it in 3 procedures of this object all of unit kcontrols

in unit kmemo, was only necessary to replace the procedure
TKMemoBlocks.PaintToCanvas of object TKMemoBlocks only that.

this repair is that routine that had developed and is now reduced in this
setting that prevents the last lines of each page to be printed or displayed
correctly. Only that.

i generate the file "adjustmentsKControl05062016.txt" that
containing the summary of the above adjustments

this works fine and is linked here

inserted: 2016-06-06 22:08:29   Reply...
From: tk
Hi, your patch works perfectly but only when there are no tables and other nested blocks. So I cannot apply your patch to the main trunk now because we heavily use KMemo tables in our projects (with print&preview). I'll soon solve the issue with truncated lines on page breaks and possibly also the preview scaling glitch. Until then please keep your modification if it works for you. It is a good reference for me as well where to start.
inserted: 2016-06-06 23:16:08   Reply...
From: RobV
hi tk,

as I perform a test to see if the line (text) is used for a table?

for example "if linebottom [i] is Table ...." (or another argument)
inserted: 2016-06-07 00:01:02   Reply...
From: tk
You should obey the principle of nested blocks by adding new virtual method chain to TKMemoBlock/TKMemoBlocks to inspect line rectangles including the nested ones. This is my idea now. For tables perhaps there should be page break before a row that does not fit anymore because text lines might end at different Y positions in each cell. I got most inspiration how Word and LibreOffice does this. Yes it is not so easy to understand this at first glance. And it is not easy to make any changes in KMemo for new people because word processing is not easy task and KMemo uses specific techniques. Plus then testing on at least 3 Delphi versions + Lazarus. But despite that useful contributions are welcome:-)
inserted: 2016-06-06 23:46:23   Reply...
From: RobV
The good news is that the adjustment that had done previously, the construction was carried out in TKCustomMemo.PaintPage and correctly display the table. Check here this executable:

When modified and simplified I transferred to the TKMemoBlocks object (which does not validate table).

I'll see if I can see the point that obstructs the table or else redo the previous routine and then put the patch.

in previous:

  if (Blocks.LineBottom[I] + ATop >= TmpRect.Top) and
  (Blocks.LineTop[I] + ATop + (Blocks.LineBottom[i]-Blocks.LineTop[i]) < TmpRect.Bottom) then
        begin .....

in the current code:

      if (LineBottom[I] > xTop) then begin ...

inserted: 2016-06-08 21:52:22   Reply...
From: tk
I've made some changes to KMemo Print&Preview today. It should already work as you would expect. Needed quite many modifications.
inserted: 2016-06-07 00:05:02   Reply...
From: tk
Nope. Does not work for me.
inserted: 2016-05-31 01:47:50   Reply...
From: RobV
hi tk,
how could copy a preview page to bitmap?

(I tried but half of the page appears in black)

inserted: 2016-05-31 09:42:04   Reply...
From: tk
I don't know, never been using this. The print preview has not been designed that way, but iirc the components themselves have the PaintToCanvas method which could be used with any canvas.
inserted: 2016-05-31 11:15:23   Reply...
From: tk
Maybe TKPrintPreviewForm.preview.PaintTo used with Bitmap.Canvas.Handle would work. Never tested this however. Lazarus has an overloaded PaintTo that can be used with Bitmap.Canvas directly.
inserted: 2016-05-31 23:11:56   Reply...
From: RobV
his suggestion did not work.
Under a situation that works with memo.blocks.paintToCanvas

procedure TKMemoFrame.SpeedButton3Click(Sender: TObject);
var bm:TBitMap;
  editor.canvas.Refresh ;
  SaveIndex := SaveDC(editor.canvas.Handle);
  bm.Width:= editor.Width ;
  bm.Height:= editor.Height+1500 ; //i.e. 1500 or more
  r:=rect(0,0,bm.Width ,bm.Height );
  Bm.Canvas.Brush.Color := clWhite;
  editor.Blocks.PaintToCanvas(bm.canvas,0,0,r) ;
  RestoreDC(editor.canvas.Handle, SaveIndex);
  editor.canvas.Refresh ;

inserted: 2016-06-01 14:40:48   Reply...
From: tk
Hmm, interesting. Why would you need to copy this to a bitmap? Some Making some screenshot?
inserted: 2016-06-01 17:00:26   Reply...
From: RobV
also logically it serves a screenshot. What worries me is with users of a text editor that will not like the preview that exists today in kmemo. This is because a different scale of 100%, the screen canvas is different from the printed canvas and so they will complain. A preview of 100% displayed is gigantic and therefore this will not practical for a user of an application.
So I am studying a way to treat via emf (initially tested now with bitmap). But I know that Lazarus has nothing ready/write in emf. In the unit kcontrol in the graphic unit, I saw that there metafile object, but do not know if it is functional.
inserted: 2016-06-01 21:03:11   Reply...
From: tk
Try new snapshot from bitbucket. I've implemented a custom variant of TKPrintPreview.PaintTo. How to use it is shown in KMemoDemo example, method Test25. Works now both in Delphi and Laz.
inserted: 2016-06-02 15:51:09   Reply...
From: RobV
ok the screenshot works fine!

but do you know any way to reduce the display in preview of
ratio of 100% as in normal editors?
inserted: 2016-06-02 16:42:09   Reply...
From: tk
TKPrintPreview has Scale and ScaleMode properties that allow custom scaling, the combo on print preview form uses these.
inserted: 2016-06-02 22:50:51   Reply...
From: RobV
1) when the user chooses
ScaleMode = smScale and scale = 25%,75%....500% (exept 100%) or ScaleMode=smWholePage or
ScaleMode = smPageWidth
the page content appears in screen canvas appears in a different position of the printer canvas

2) when the user chooses ScaleMode = smScale and scale = 100%
the page content in screen canvas appears in the same position the printer canvas, only with the use of that reparative code posted to you via link.

The problem is that with scale = 100% the text or content is displayed on screen canvas as very large , hindering navigation

for example, the components for Delphi, TRichView, TextControl, DevExpress, or any wordprocessor, the scale = 100% is displayed in the normal almost equivalent to scale = 75% of KControl but if you use it, you will have problems with printing in different positions as reported.
Once solved this issue, it will be the component that meet "initial" conditions for a word processor, for Lazarus, distancing even more of richmemo component.

Today, the only strong point of richmemo on Kmemo is the zoom property that works in normal editing text.

inserted: 2016-06-03 14:56:54   Reply...
From: tk
To be honest I don't understand what is the problem. I cannot reproduce any differences between preview and print (tested on a PDF printer now).
Yes 100% preview is now bigger than in other programs (I don't consider this a bug because it now maps printer resolution to desktop resolution 1:1, it might be configurable in future however to consider DPI even here).
And of course there is LOT of work to do on this component.

Because this forum does not accept images you could perhaps open a thread for this on Lazarus forum.
inserted: 2016-06-03 15:42:10   Reply...
From: RobV
Hi tk

 see in

 (with your last version of kmemo)
inserted: 2016-06-03 22:10:58   Reply...
From: tk
Aha, this I don't take as bug by far:-) Is only small glitch...
Please don't take TKMemo as replacement of TRichView or any other fully fledged component, is not meant to be, maybe sometime in VERY distant future...
inserted: 2016-06-05 16:58:40   Reply...
From: RobV
my expectation with kcontrols is good just to be part of lazarus what other referenced components are not part. It is necessary to go through time to evolve. In the code free nothing is ready, and programmers
They work harder. This brings evolution to those who participate!
inserted: 2016-06-03 15:49:17   Reply...
From: RobV

you could tell me where considered a property to desktop resolution 1: 1? (So I can understand better)

inserted: 2016-05-26 04:09:19   Reply...
From: Бегемот
Nice try but it won't work with RX10 Seattle.
inserted: 2016-05-26 20:33:37   Reply...
From: tk
The repo download should work already, although I didn't test this myself.
inserted: 2016-05-27 03:57:45   Reply...
From: Бегемот
Nope. The package installs with no components. Maybe Win10 is the cause...
inserted: 2016-05-27 10:32:47   Reply...
From: tk
Hmm, was contribution from another user. Maybe the package for D10 is corrupted. The ever soaring prices for Delphi are the cause that I haven't tested this myself yet. I/we won't buy Delphi anymore, will entirely migrate to Lazarus. But I'll at least download the evaluation and try this package myself.
inserted: 2016-05-27 10:56:49   Reply...
From: tk
Will test only the new Berlin release.
inserted: 2016-05-27 12:29:01   Reply...
From: tk
Tested now on 10.1 and modified also the Seattle packages a little. The run time package was corrupted, missing the KDBGrids.pas file. For some reason I had to add path to sources to the design time package dproj files, don't know why Delphi suddenly did not find the res files etc. when compiling design time package. Things that worked fine all the time don't work anymore:-( Seems that the new Delphi versions are not only more and more expensive, but even worse and worse.

I still have W7 but the programs we create with KControls run on W10 normally.
inserted: 2016-05-23 16:06:38   Reply...
From: RobV
Hi Tk,

I believe you will like to see these settings in the preview of kmemo (only).
I Fix so that the texts were not being displayed properly when the page
changes, both in preview and in printOutput. Modifications incorporated,
sought comment with "//Adicionei"

I posted the link below for you to download (I will leave a few days)

I could not make all text displayed in the preview,
is exactly the same position when printed (eg pdf creator,
Microsoft print to pdf or HP printers).
This is for you to know quite the windows api.

The result is that the kmemo is approaching an
WYSIWYG editor

The next step is to place a ruler in this editor
inserted: 2016-05-24 09:15:12   Reply...
From: tk
Thank you but could you modify the newest repository snapshot and send me the patch? This way I am unable to apply your contributions to the main trunk.
inserted: 2016-05-24 15:53:48   Reply...
From: RobV
I do not know the latest repository. What is it?
inserted: 2016-05-25 10:59:15   Reply...
From: tk
See above, the link to BitBucket. Please go there and download current repo snapshot. Implement your modifications there. I/We must review each contribution thoroughfully to avoid some problems in our projects.

After a short review of your modifications I have following notes:

Please avoid old fashioned constructs like:

  PLinkNP = ^AListNP; //Adicionei*
  AListNP = record //Adicionei*
    I:integer; // = line
    Value:integer;// = page

  PLinkTop = ^AListTop; //Adicionei*
  AListTop = record //Adicionei*

Instead of these use classes and object lists (because of compatibility with old Delphi versions use normal object lists with custom getters and setters, see the many helper classes in kmemo.pas for reference).

Also please ALWAYS avoid using global variables!

  linkPagePrev: Integer;//Adicionei*

This way the {$WEAKPACKAGEUNIT ON} directive would not work in Delphi! Rather than that use some helper classes for this and instantiate them directly in TKCustomMemo class (or whenever you use it)!

Also please avoid commented out code chunks when possible.

Thank you
inserted: 2016-05-25 17:22:30   Reply...
From: RobV
I did so (temporary) because they do not know with certainty the structure of objects in kcontrol. The primary objective was to test what was inconsistent. (I'm new here ok?) Anyway I appreciate your guidance and few know its structure, will have conditions
to incorporate in existing objects.

tk: what is the reason of a plain text is displayed in a position (preview canvas), different from what is printed (printer canvas)? Where (procedure / functions) you suggest I can step up testing to try to hunt this inconsistency?

inserted: 2016-05-26 20:03:22   Reply...
From: RobV
tk: in the lazarus (because I am avoiding using the Delphi)
I tested considering {.$DEFINE KMEMO_DISABLE_KERNING} whether the texts are now displayed in the screen canvas as the printer canvas that is ok!

you'd better clarify the reason for this occurrence since the file the question is about speed and not text display position.
inserted: 2016-05-26 20:31:26   Reply...
From: tk
I remember having problems with kerning pairs when testing under Linux Kubuntu. That's the reason for this directive, the problem was IMO not in Lazarus but in underlying GTK engine.
inserted: 2016-05-21 00:15:36   Reply...
From: iru
Could you please explain the relationship between CELL, CELLS and COLUMN/S?
I am having troubles with "column" display widths when I use "KDBGrid.Cells[0, ?] := 'xxx'. How can I control the "CELL, ""COLUMN"width?
inserted: 2016-05-21 02:06:52   Reply...
From: iru
On a closer look the problem is not the width of the displayed columns but that some columns overlap others. For example, if I have a grid with 10 columns and perform the following:
  For i := 2 to 5 do
    KDBGridLap.Cells[i, 0] := 'Lap ' + IntToStr(i);

The display is: Col0|Col1|L|L|L|Lap 5|Col6...... (where Col0/1/6 are "normal" columns).
inserted: 2016-05-22 14:22:46   Reply...
From: tk
Don't understand what you're up to. You're assigning values to Cells in a DBGrid? But that's IMO generally wrong unless I miss sth. In KDBGrid cells are automatically filled with data from the data set and your values get overriden on next data update event!

To adjust column widths use ColWidths property or the Columns[x].Extent property at design time. At runtime Cols[x] is quite equal to Columns[x] (Cols is just shorter variant for Columns).
inserted: 2016-05-24 12:37:03   Reply...
From: iru
Apologies about KDBGrid, should have been KGrid.

I have been looking at KGrid source and pottering with my code.
Issuing KGridLap.Cols[vCtr].MinExtent := InSize (where InZize is 55,just longer than the size of something like 'Lap 12.0') seems to resolve things.

Thank you for your response, Ian
inserted: 2016-05-29 12:57:53   Reply...
From: iru
Some more this. Setting KGridLap.Cols[vCtr].MinExtent solved the problem once.

Run some code, the column widths are OK, columns are visible.
Run the same code again and the columns are in-visible.
Run the same code again and the columns are OK, columns are visible.

I have put traces in the KGrid code and have been able to work out where things start to go wrong.

I have inserted some ugly code at the start of Kgrid.SetVisible as follows:
    FBackExtent := 0;
    Extent := 64;

Ugly but it fixes the display.

I think it will take me some time to sort this out.With your experience with KGrid it may be simple.

The application is small and self contained. Is there some way I can send it and usage instructions?

Thanks, Ian.

inserted: 2016-05-31 09:30:46   Reply...
From: tk
Thank you for the example but it cannot be loaded. Lazarus reports: Unable to find the component class "TLEDNumber"... It is needed by unit:...frmmain.pas.
inserted: 2016-05-31 09:45:18   Reply...
From: tk
Was the missing industrial package (my Laz strangely reported the missing package only when compiling, not when loading the project).

But there are another errors when compiling:
Compile Project, Target: LS.exe: Exit code 1, Errors: 8, Hints: 1
frmmain.pas(158,3) Note: Local variable "vTime" not used
frmmain.pas(266,12) Error: Identifier not found "vSList"
frmmain.pas(285,12) Error: Identifier not found "vSList"
frmmain.pas(307,22) Error: Identifier not found "vSList"
frmmain.pas(341,27) Error: Identifier not found "vSList"
frmmain.pas(342,27) Error: Identifier not found "vSList"
frmmain.pas(393,4) Error: Identifier not found "DataModuleDB"
frmmain.pas(393,36) Error: Identifier not found "DebugIni"
frmmain.pas(393,61) Error: Identifier not found "DebugIni"
inserted: 2016-05-31 10:09:58   Reply...
From: tk
Ok, run it on Win, had to add the vSList to kgrids.pas and comment out the line:
DataModuleDB.DM.AppName := Copy(DebugIni, 1, Pos('.INI', DebugIni)-1);

Then I could find the problem.


Procedure UpdateVis(InCol : Integer; InNumber : Integer; InState : Boolean);
    vCtr :Integer;
    For vCtr := InCol to (InCol + InNumber - 1) do
      if InState then
        KGridLap.ColWidths[vCtr] := KGridLap.DefaultColWidth
        KGridLap.ColWidths[vCtr] := 0;

Don't use Cols[x].Visible because it is known to be somewhat buggy. Also you should use ColCount instead of this to specify column count. This will avoid hidden columns.
inserted: 2016-05-30 22:33:22   Reply...
From: tk
Well, I still don't understand what is the problem. I don't use MinExtent properties so there might be bug. Please create a simple app that demonstrates the problem and send it to the email provided in source headers.
Thank you
inserted: 2016-05-31 23:56:21   Reply...
From: iru
Thank you for your response and your work. Apologies for the missing components/errors in the code. Must be strange things in my LAZ IDE.

All fixed, problem solved.
Thanks once again, Ian
inserted: 2016-05-14 03:10:52   Reply...
From: RobV
Hi tk,
to add single image from clipboard

function TKMemoBlocks.AddImageBlockFromClipBoard(At: Integer): TKMemoImageBlock;
var pic : TPicture;
     Jpg : TJPEGImage;


  if (Clipboard.HasFormat(PredefinedClipboardFormat(pcfDelphiBitmap))) or

  (Clipboard.HasFormat(PredefinedClipboardFormat(pcfBitmap))) then begin

    Result := TKMemoImageBlock.Create;

    pic:=TPicture.create ;

    if Clipboard.HasFormat(PredefinedClipboardFormat(pcfDelphiBitmap)) then



    if Clipboard.HasFormat(PredefinedClipboardFormat(pcfBitmap)) then


     Jpg := TJpegImage.Create;
       Jpg.Assign(pic.Graphic );

       AddAt(Result, At);



inserted: 2016-05-15 05:42:43   Reply...
From: RobV
small adjustment to copy the contents of clipboard to exact location of the cursor positioned

function TKMemoBlocks.AddImageBlockFromClipBoard: TKMemoImageBlock;
var pic : TPicture;
     Jpg : TJPEGImage;


  if (Clipboard.HasFormat(PredefinedClipboardFormat(pcfDelphiBitmap))) or

  (Clipboard.HasFormat(PredefinedClipboardFormat(pcfBitmap))) then begin

    Result := TKMemoImageBlock.Create;

    pic:=TPicture.create ;

    if Clipboard.HasFormat(PredefinedClipboardFormat(pcfDelphiBitmap)) then



    if Clipboard.HasFormat(PredefinedClipboardFormat(pcfBitmap)) then


     i:= Count ;

     Jpg := TJpegImage.Create;
       Jpg.Assign(pic.Graphic );

       AddAt(Result, i);




procedure TForm1.SpeedButton1Click(Sender: TObject);
  Stream: TMemoryStream;
  S: TKString;
  IB: TKMemoImageBlock;

    IB := KMemo1.Blocks.AddImageBlockFromClipBoard;
    if ib=nil then ib.Free
    else begin

     i:=kmemo1.blocks.Count-1 ;
     kmemo1.Blocks.Items[i].SelectAll ;

      S := kmemo1.ActiveBlocks.SelText;
      Stream := TMemoryStream.Create;
        kmemo1.SaveToRTFStream(Stream, True);
        Stream.Seek(0, soFromBeginning);
        kmemo1.LoadFromRTFStream(Stream, kmemo1.RealSelEnd );

      kmemo1.ActiveBlocks.ClearSelection(false) ;



inserted: 2016-05-22 14:10:04   Reply...
From: tk
Thank you.
inserted: 2016-05-13 15:29:51   Reply...
From: Woj
When I use kPrint in preview I see only records which are visible on the screen, other records are empty.
But when I scroll down in kdbgrid these records appear. Earlier I used dbgrid.datasource.dataset.last function to bypass problem, but now I have more records (abaout 500) and this trick doesn't work. Could you tell me what can I do to solve this problem?
inserted: 2016-05-14 13:51:04   Reply...
From: tk
The preview shows only currently loaded rows/records from the dataset. It does not load new records like when scrolling the grid. If you want to show all records in the preview then you must somehow load them into the grid. You can try new method LoadAllRecords that simplifies that task for KDBGrid, see the repo.
inserted: 2016-05-15 21:49:37   Reply...
From: Woj
It's what I've been looking for, thank you very much.
inserted: 2016-05-04 14:28:59   Reply...
From: HexUser
Is it possible to group only 2 Hexchars in the KHexEditor, for viewing full Bytes (8 Bit)?
inserted: 2016-05-09 10:58:33   Reply...
From: tk
Yes, use DigitGrouping property.
inserted: 2016-05-09 15:01:27   Reply...
From: HexUser
inserted: 2016-05-04 12:07:44   Reply...
From: Whisper
I've got a problem with Kgrid.
I'm doing an application and If I add the following code to the event "DrawCell" (Resultados is the kgrid type).

the code is for formatting the cells
procedure TBuscaDu.ResultadosDrawCell(Sender: TObject; ACol, ARow: Integer;
  R: TRect; State: TKGridDrawState);
   Resultados.CellPainter.Text := Resultados.Cells[ACol, ARow];
   if (ARow > 1) and (ACol >= 3) then Resultados.CellPainter.HAlign := halRight;
   if (ARow = 0) and ((ACol = 3) or (ACol = 4)) then Resultados.CellPainter.HAlign := halCenter;
   if (ARow = 0) and (ACol >= 1) then
         Resultados.Font.Size := Resultados.Font.Size+10;
         Resultados.Font.Bold := TRUE;
   if (ARow = 0) and (ACol >= 1) then
         Resultados.Font.Size := Resultados.Font.Size-10;
         Resultados.Font.Bold := FALSE;

Kgrid blocks the red button to finish the aplication. I can NOT close/terminated the aplication

Is it a bug?

PD: I've uploaded a simple test project where you can see the problem. If you press the NEW button, Kgrid show up and now if you push the closed/finish red button, it doesn't work properly.!3QMm1Jha!PpUKtWYSG_-wTj68NftlpoUtSyv3HSouwOCYM9CQj8w
inserted: 2016-05-06 12:37:38   Reply...
From: Whisper
Fixed the issue:

if I change:

Resultados.Font.Size -> Resultados.CellPainter.Canvas.Font.Size

The same for the rest of code
inserted: 2016-05-16 09:55:16   Reply...
From: tk
You should only access Resultados.CellPainter.Canvas.Font in OnDrawCell, not Resultados.Font.
inserted: 2016-05-02 13:57:24   Reply...
From: CrazyDron
Good day!
I have installed v1.7 of KControls and using Win7 x64.

After creating new project and adding onto form control TKGrid - it compiles normal.

But when I set options of project to:
1. Target OS: WinCE
2. Target CPU: arm

compilation stops at unit CairoCanvas and says
cairocanvas.pas Fatal: Cannot find unit Cairo, used in CairoCanvas of package cairocanvas_pkg.

(Remark: units Pango, PangoCairo, GLib2 are not founded too).
What should I do?
Thank you.
inserted: 2016-05-02 21:04:30   Reply...
From: tk
I think your Lazarus installation or build configuration is corrupt under Linux or not ready for cross compiling. I am not expert here. Please search or ask on Lazarus forum There are many clever people that might be able to help you.
inserted: 2016-05-03 08:05:17   Reply...
From: CrazyDron
Thank you, and my apologizes about not refining that I write in Lazarus.

My Lazarus installation is Win32+cross_arm_ce.
I write big project for WinCE/arm, and it compiles and works perfectly. But all this is on standard installation, external components is only KControls.

Maybe this information help you (and me too :D ).

inserted: 2016-05-03 12:16:45   Reply...
From: tk
Well, I don't have this installation so I am not able to help you. Generally I've always tested only on Win or Linux, x86 or x64. I don't even know if KControls works in other widget sets.

Please ask on Lazarus forum about this error.

inserted: 2016-05-01 16:13:28   Reply...
From: Whisper
I have a problem with Kgrid and CheckBox.

I add checkboxes to col 0 (the first of the left side) in kgrid with the code:

procedure TBuscaDu.ResultadosDrawCell(Sender: TObject; ACol, ARow: Integer; R: TRect; State: TKGridDrawState);
   if (ACol = 0) and (ARow > 0) then
        Resultados.CellPainter.CheckBox := TRUE;
        Resultados.CellPainter.CheckBoxHAlign := halCenter;
        Resultados.CellPainter.CheckBoxState:= cbchecked;
(Resultados is the kgrid type)

but I don't know how i can change the state from the cbchecked to cbUnchecked from one of the checkboxes with click of mouse (I make a click, but it doesn't change) and how I can detect if the user change the checked state.

Thanks in advanced
inserted: 2016-05-02 21:00:34   Reply...
From: tk
You have to instantiate a TCheckBox as inplace editor. Look in the demo how to do that.
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


by: tk


Grouping of comments

by: tk



by: tk


My recent work on KMemo

by: tk


Update for RAD Studio XE2

by: tk