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. File Version Number of downloads Available for: Changes 1.7 9091 Delphi 7+,Lazarus 1.2.2+, CBuilder 2007+ support for RAD Studio XE8, major work on TKMemo which is already usable, bugfixes. 1.6 2816 Delphi 7+,Lazarus 1.2.2+, CBuilder 2007+ support for RAD Studio XE6, Columns property in TKDBGrid, bugfixes.
Lazarus Database Tutorial. From Lazarus wiki. Jump to: navigation, search.
![]()
1.5 430 Delphi 6+,Lazarus 1.2.2+, CBuilder 2007+ new components TKMemo, TKBitBtn, TKColorButton, some bugfixes. 1.4 1064 Delphi 6+, Lazarus 0.9.29(SVN#21827)+, CBuilder 2007+ support for RAD Studio XE3-XE5, new components etc. Newbee(s) ME are a pain, but that said: I never had much fun in installing Delphi 2-6 components with Borland changing it on every release. This is a (How to) on installing kControls. I'm using Win10 and Lazarus v1.8 I've used the latest version of kControls found at bitbucket, and it has a huge long filename. Download and open the zip file to somewhere nice, extract the zip file somewhere nice.
Note here: the bitbucket file name does change, but mine was called tkweb-kcontrols-0dbad6b6449e.NOW. COPY the Folder called (tkweb-kcontrols-0dbad6b6449e) to the (components) folder under Lazarus, I renamed my folder to (kcontrols) to make it easier to read. In Lazarus: find the Package menu and select it. Then find Open Package File (.lpk) then select that one. It will open a file-dialog. Navigate to C: lazarus components tkcontrol(whatever you called it) packages kcontrols In this folder (directory), you will see two files, kcontrolsbase.lpz and another one called kcontrolslaz.lpk - select it and then double click. You will then see a long drawn out box full of files, ignore them and click USE - on one of the top menu items.
Click on second on down that says Install, the new pop-up will say that Unicorns live here: press accept. Then press accept that you'll be a fatty.
And now you can sit back and wait, and wait: and wait - (well: I had to). Hopefully after Lazarus has rebooted, you should see a new tab at the end called TK. Now: if you don't, then Install that second file called kcontrrolbase.lpz I personally had to Install them twice before I finally had that TK tab. The text above represents an evening of pure frustration: cos this newbee was a confused as (lots) by reading, and then re-reading how to Install new components under Lazarus, and not one of the sets of Instructions I read made sense.
Hopefully, you will have it a bit easier. This is a note to all you experts out there, if it's wrong: then tell me an easier way. Happy tGridding, cos I'm amazed by what these added controls can do, thank-you very much tk for providing them. How do I report an issue? I just started using the bitbucket snapshot of KMemo component. I am working with the kmemo editor demo.
It seems that when I first run the demo, the first letter I press is displayed and the cursor is placed before it. In other words, if I type 'this' (without quotes) then I see 'hist'. If I then delete what I've typed and start again, then it is ok. While stepping through the code, I've noticed in TKCustomMemo.ExecuteCommand that, right after I run the demo and press my first key, TmpSelEnd is set to -1. When I erase what I've type and do it again, then TmpSelEnd is set to 0. I'm using the latest releases of fpc/lazarus and the 'hist' behavior happens both on my Windows 10 machine, and also on my Mac using Cocoa widgetset. Is it me, or is it a bug?
After some searching, I modified KEdits.pas as follows, starting from line 1428 (in function TKNumberEdit.InspectInputChar) as follows: if CharInSetEx(KeyFLoat, '0'.' 9','-', '+', '.' , ',', 'e', 'E', DecimalSeparator, #8) then //added '+' begin if (KeyFloat = '-') and ((SelStart 0) and (UpCase(SSelStart) 'E')) then KeyFloat:= #0; //added and (UpCase(SSelStart) 'E') if (KeyFloat = '+') and ((SelStart 0) and (UpCase(SSelStart) 'E')) then KeyFloat:= #0; //new line added There are two lines modified and one new added. Seems to work OK for me. It allows '+' and '-' signs both at start and after an 'e' or 'E'. I have updated the code to work on Lazarus 1.8.4 on Mac. Add LazUTF8 to the uses clause for Memo and MemoRTF and KFunctions.
Then I had to change MainTheadID from LongWord to TThreadID (where you define ctx). And everything appears to operated on a Mac now. I am still testing. But, wanted to share this, so others can get KControls working!. Do you have a function by function demonstration?
I used to use TRichView (registered version) on Delphi as a DOS CRT for my GUI application. Now, I am porting to Lazarus, and trying to port all my code to KMemo.
I'd like to bring to your attention a problem I can demonstrate in both the KMemo and KMemoEditor demo applications that come bundled with KControls. And, obviously, in my own KMemo based app too. Only under Linux. Step by step? Open the demo KMemoEditor, click 'new' to get a new KMemo. Enter two lines.
Make the first line a bullet, select and copy the second line, paste. In my case, the bullet character changes to the invalid UTF8 character, i.e. The black diamond with a question mark. When this happens, a large number of GTK errors appear on the console - (KMemoDemoLaz:7195): Pango-WARNING.: Invalid UTF-8 string passed to pangolayoutsettext Conditions are quite critical to reproduce.
Firstly, you must copy something from a KMemo that already has a bullet. Then paste it into a KMemo that has a bullet. That triggers it. Copying an apparently identical piece of text from a KMemo that does not have any bullet in it won't trigger! It does not matter where in the KMemo you copy from or paste back into.
A related (?) issue seems to be when you copy and paste a UTF8 char, if it is both from and to a KMemo, it fails. Paste it elsewhere and recopy and you can paste it successfully back into the original KMemo window or another one. Very strange behaviour! Sorry TK, I raised two issues in one message, I should know better. Anyway, to demo the copy UTF8 (on linux, Lazarus 1.8) issue, very easy. New Form, drop a KMemo on it, compile and run. Then, copy some UTF8 (ie non-ASKII) characters into the KMemo (Ctrl-V).
They appear fine. Then, in the KMemo, select the same characters, and copy the selection (Ctrl-C), click at the end to clear the selection and paste, Ctrl-V. In my case, invalid characters appear. What were two byte UTF8 characters become one byte characters in the ASKII set above char(128) which should not, of course, appear in a UTF8 string. No sign of either issue on Windows. OK, here is a summary of whats happening - On windows, the call to StringToAnsiString(C, FCodePage); at kmemortf#4098 converts a single Unicode multibyte character (in the var C) to single byte (code page aware?).
On linux, it is not changed, that is, it remains a two byte unicode character. That is because in LConvEncoding#7392, the function ConvertEncoding(const s, FromEncoding, ToEncoding: string ): string; has decided the string does not need to be converted. Effectively, as GetDefautTextEncoding returns 'utf8', we are asking it to convert UTF8 to UTF8. So, quite reasonably, It decides to pass the string back as it is, still in multibyte form. However, a little further down, the first byte of C is used to generate the RTF string that will be pushed into the clipboard.
Obviously, in Linux, this is wrong, the first byte does not describe the character. Indeed, having a character like that there, that look like its the first byte of a unicode character messes with the unicode display in KMemo (when and if its pasted back in). The Blocks.Delete function in KMemo is puzzling me. I can delete a word starting at TKSelectionIndex(Index) like this - for Cnt:= 1 to UTF8Length(TheWord) do TheKMemo.Blocks.DeleteChar(Index); And it works fine as long as - 1. No other text in the KMemo is selected at that time.
If it is, the 'other text' is deleted with first iteration and then a character is correctly deleted for each subsequent iteration. We don't delete the last character in a block. Doing so triggers an exception if we have called LockUpdates. Making use of what might be an 'unintended feature', that is selecting the text to delete and calling DeleteChar with some random parameter does delete the selected text, does not care about LockUpDate status and is faster. Like this - TheKMemo.SelStart:= Index; TheKMemo.SelEnd:= Index + UTF8Length(TheWord); TheKMemo.Blocks.DeleteChar(0); But it does look like I am using DeleteChar in a way you did not intend and might 'fix' in the future.
I want to delete, for example, a word independent of what is, or is not selected. It looked like.deletechar(x) was suitable but it delivers a surprise iff something happens to be selected. That something is deleted instead, even if its at the other end of the document, the passed parameter is ignored. After the first call, deletechar(x) has deleted the selection and therefore nothing is selected, subsequent calls to deletechar(x) behaves as expected, the char at x is deleted. If this is intended behavour, I'll use it. I save the existing selection values, set them to what I want to delete, call deletechar (or even ClearSelection) and restore the previous selection values. Not hard but I don't believe in doing things unnecessarily or depending on things that look 'surprising'.
Hi, I have troubles with ScrollBy (example below) in Lazarus 1.8. If I try to use KMemo1.ScrollBy(0,20,True); my app does not compile, saying „Error: Wrong number of parameters specified for call to 'ScrollBy'‟. If I press alt+arrowup in the IDE I am taken to ScrollBy defined in kmemo.pas 2. If I remove last parameter and try to use KMemo1.ScrollBy(0,20); nothing happens when executing the code (no scroll is done, I tried +20 and -20).
If I press alt+arrowup in the IDE I am taken to ScrollBy defined in Controls.pp. I guess something goes wrong with visibility of ScrollBy? Procedure TForm1.Button1Click(Sender: TObject); var i: integer; begin kmemo1.Blocks.clear; for i:=1 to 50 do begin kmemo1.Blocks.AddTextBlock(IntToStr(i)); kmemo1.Blocks.AddParagraph; end; KMemo1.ScrollBy(0,20); end. I am just starting to use Lazarus after having used Delphi for 15 years. I'm using the Lazarus 'Fix' version which is 1.8.1. In the Lazarus forum, some one suggested I use KMemo. I downloaded your v1.7 and tried to compile and the compiler complained about the UTF8Copy (and Character) functions.
I added the unit LazUTF8 to the necessary 'Uses' clauses and it compiled and installed your components. My next step was to uninstall the v1.7 then install your latest version from bitbucket. The v1.7.1 from bitbucket has a.lpk but the Package installer complains that there are no registered components in it, so the Lazarus IDE will bloat up, and no components will be visible on the componenent palette. I proceded with the install then uninstalled. (I did notice that the compiler did not complain about any UTF8 stuff, which was my original goal installing your latest version from bitbucket) My question is: How do I install your latest.lpk from bitbucket so that the components show up on the component palette? Thanks in advance for any help you can provide. Hi Tk, Since the very beginning I have had problems with tables staying locked.
I think I have finally found the solution and possibly the reason for that. My code was someting like: KMemo1.Blocks.LockUpdate; Now it is something like: if KMemo1.Blocks.UpdateUnlocked= true then begin KMemo1.Blocks.LockUpdate; end; Looking in the code of TKMemo it occurs that locking state is stored by an integer FUpdateLock, and each time LockUpdate is called FUpdateLock is increased.
Is there (still) a reason for that behaviour (using INT instead of BOOL), or shall I write in wiki, that LockUpdate shall be called only this way: „if KMemo1.Blocks.UpdateUnlocked= true then KMemo1.Blocks.LockUpdate;‟? Hello TK and thanks first of all. I recently downloaded latest KControls version and tried to use with Lazarus 1.8 but when compiling projects I get the below error: Warning: other unit files search path (aka unit path) of 'KControlsLaz 1.7' contains 'C: lazarus components KControls1.7 source', which belongs to package 'KControlsBase' Warning: other unit files search path (aka unit path) of 'KControlsBase 1.7' contains 'C: lazarus components KControls1.7 source', which belongs to package 'KControlsLaz' I tried to uninstall, clean up directories and reinstall but no way. How can I fix it?
Hi TK, you have not heard from me for a while (good, eh?). Been building a replacement for Tomboy Notes in Pascal and, of course, KMemo. KMemo is such a product! Thanks However, I am having an issue with cut, copy and paste.
Two separate issues in fact. Firstly, you sensibly respond to Ctrl-xcv but on a Mac, because its a Mac, it should be another shift key, the 'Command' key. Stupid but true!
The other issue is more subtle. On Linux and Windows the cut, copy and paste do not work when an app is first started. It takes a couple of repeated cycles and then does work fine for the run time of the app. Same result whether you use the (eg) Ctrl-v or a menu driven call to KMemo1.ExecuteCommand(ecPaste); To further complicate, it does work first up occasionally. And, yes, I can demo this in a simple app. Once it starts working, its OK, so I am wondering if there is some initialization required I don't know about? I'm using head version of KControls (couple of months old) and Lazarus 1.8 David.
The Command key on MAC: I am not a MAC expert but I think even Lazarus itself does not respond to this key and it IMO can't because there is no ssCommand modifier in Classes.TShiftStateEnum. To test on MAC I just use a virtual MAC where I remapped all keys to suit my Windows keyboard and default Windows behavior. Cut, copy and paste work fine for me in the KMemo demos (all supported platforms).
Did you try with these demos? If yes then maybe Lazarus 1.8 is buggy (but this I doubt even though I always use Lazarus trunk) or you have another problem in your PC like a virus, hardware problem etc. If no then there is problem in your program using KMemo. Thanks for the Mac fix, will have a go at it today. Yes, I have seen the copy and paste issue in KmemoEditorLaz. But a lot less often (??). Spent an hour or so this morning trying to identify a pattern but nothing clear.
But an impression that I see the problem in my simple demo only when my main app is running. Conversely, I see the problem lot less in my main app when your demo IS running!
I suspect my current data is more noise than data. Can you suggest where I should set a watch to see (eg) ctrl-v being handled? I am quite sure I don't have a hardware issues and pretty confident about viruses (linux), its a code issue and probably in my code. I do intercept keystrokes going to KMemo to do thinks like check for backspaces around bullets and some other application specific stuff.
Thanks for your help! HI procedure TForm1.KGrid1EditorCreate(Sender: TObject; ACol, ARow: Integer; var AEditor: TWinControl); begin If (ACol = 0) or (ARow = 0) Then AEditor:= TEdit.Create(nil); If (ACol = 1) and (ARow = 1) Then Begin AEditor:= TComboBox.Create(nil); TComboBox(AEditor).Style:= csDropDown; // cannot set height on Win!
End; If (ACol = 2) and (ARow = 1) Then Begin AEditor:= TCheckBox.Create(nil); TCheckBox(AEditor).Font.Color:= clRed; // applies only without OS themes (in Delphi) end; KGrid1.UnlockUpdate; end; procedure TForm1.FormCreate(Sender: TObject); begin KGrid1.Cells1,0:= 'ComboBox'; KGrid1.Cells2,0:= 'CheckBox'; end; That's what I wrote, and at startup you do not see what's in the cell. If I turn on the checkbox, switch to another cell, then back, it will not stay on. Quotation marks (single or double) are not word breaks. There must be some other logic in Word, browsers etc. Which is not yet implemented in KMemo. Actually the behavior between different programs varies here. Example: you've MS Word correctly selects entire contraction(irrelevant where you double click), Firefox selects either 'you' or 've' on a double click.
Afaik for both single quotation marks and English contractions, possessives etc. The same character (U+0027) is used, which means there must be some extra logic to distinguish them.
I used to be able to disablecontrol, save the record number of the dataset, post updates, locate the record number, enable controls and have the DBGrid back to it's original position. Now, when I do this and the record in question is past a full page of data down the grid, the grid refeshes so that the record in question is at the bottom (last line) of the grid rather than where it was e.g. It's not out of sync or anything, if I save while sitting on the second record of the dataset and second row of the grid, all is fine, but if not, the grid refreshes and the currnet record position in the grid jumps - a little disturbing for the user. Does anyone know how to work around this? There is only a scrollby pixel method, there appears no way to remember the grid row as well as the record number and place the record number returned to on the grid row it was on before.
How do you surface the grid row property if there is one? There are TDataSet.Bookmark and TDataSet.CurrentRecord. When a dataset locates a bookmarked record, it places it in the middle of the record buffer (i.e middle of the grid). DisableControls, store the CurrentRecord, locate to the middle row, bookmark it, do whatever you need, return to the bookmarked record, it will be placed in the middle, move to the old CurrentRecord. Andrei Fomine www.quasidata.com DbAltGrid - multi-line layout, RTF and graphics of any kind in DBGrid.
Transfer@once - full-blown clipboard and drag-and-drop data transfer to/from any control in many formats, including ones native to MS Office. Quote I used to be able to disablecontrol, save the record number of the datasetpost updates, locate the record number, enable controls and have the DBGrid back to it's original position. Now, when I do this and the record in question is past a full page of data down the grid, the grid refeshes so that the record in question is at the bottom (last line) of the grid rather than where it was e.g. It's not out of sync or anything, if I save while sitting on the second record of the dataset and second row of the grid, all is fine, but if not, the grid refreshes and the currnet record position in the grid jumps - a little disturbing for the user. Does anyone know how to work around this? There is only a scrollby pixel method, there appears no way to remember the grid row as well as the record number and place the record number returned to on the grid row it was on before. How do you surface the grid row property if there is one?
Thank Andrei, That's close. Even though Bookmarks are not valid between closing and opening a dataset, I can open the dataset, locate the currentrecord, get a bookmark, then gotothat bookmark. Same result, the cursor is in the mddle row. But the jump from other places in the grid to the middle row is not much different to jumping to the bottom. What I need is to return the cursor to the same row in the grid that I had before and to move the start of the buffer to the same start point as well so that the cursor is in exactly the same position.
Maybe can't be done? There is no return for the current buffer start point is there? Quote There are TDataSet.Bookmark and TDataSet.CurrentRecord. When a dataset locates a bookmarked record, it places it in the middle of the record buffer (i.e middle of the grid). DisableControls, store the CurrentRecordlocate to the middle row, bookmark it, do whatever you need, return to the bookmarked record, it will be placed in the middle, move to the old CurrentRecord. - Andrei Fomine www.quasidata.com DbAltGrid - multi-line layout, RTF and graphics of any kind in DBGrid. Transfer@once - full-blown clipboard and drag-and-drop data transfer to/from any control in many formats, including ones native to MS Office.
'Alan McDonald' wrote in message news:[email protected]. I used to be able to disablecontrol, save the record number of the datasetpost updates, locate the record number, enable controls and have the DBGrid back to it's original position. Now, when I do this and the record in question is past a full page of data down the grid, the grid refeshes so that the record in question is at the bottom (last line) of the grid rather than where it was e.g. It's not out of sync or anything, if I save while sitting on the second record of the dataset and second row of the grid, all is fine, but if not, the grid refreshes and the currnet record position in the grid jumps - a little disturbing for the user.
Does anyone know how to work around this? There is only a scrollby pixel method, there appears no way to remember the grid row as well as the record number and place the record number returned to on the grid row it was on before. How do you surface the grid row property if there is one?
Comments are closed.
|
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |