KControls Question lazarus / 21-General ---------------------------------------------------------------------- Badger · 2023-03-01 12:08 This is probably not the correct forum but I'll ask anyway. I've just started using KControls and have come up against a problem. I loaded a frame onto my form and chose kmemofrm.pas.  I added kMemo to the uses list but when I try to run it I get the error "Can't find unit kmemoframe used by unit 1" I can't find which unit the program requires.  If I put kmemoframein the uses section the program doesn't like it one bit.  Can anyone help? ---------------------------------------------------------------------- Zvoni · 2023-03-01 12:54 Quote from: Badger on March 01, 2023, 01:08:30 pmThis is probably not the correct forum but I'll ask anyway. I've just started using KControls and have come up against a problem. I loaded a frame onto my form and chose kmemofrm.pas.  I added kMemo to the uses list but when I try to run it I get the error "Can't find unit kmemoframe used by unit 1" I can't find which unit the program requires.  If I put kmemoframein the uses section the program doesn't like it one bit.  Can anyone help? Usually, with visual controls you don't have to add anything to the uses-clause. The IDE does it for you. Maybe it has to be added as a required package. No idea. Never used it. ---------------------------------------------------------------------- wp · 2023-03-01 13:43 Installed KControls to check your issue but did not find anything wrong. I am attaching a small project which puts a TKMemo into a TFrame (--> TKMemoFrame) and - upon button click - creates a new tab in the pagecontrol of the mainform and puts a new instance of TKMemoFrame into the new tab. ---------------------------------------------------------------------- Badger · 2023-03-02 12:03 Doing it that way does not give the "Word Processor" frameI was trying for. There were no toolbars. WP, Could I ask you to open a new Application, add KControlsLaz and KControlsBase to the Project Inspector then put a frame from the 'standard' tool bar onto the form and chose kMemofrm.  Then try to run it. When I do that I get an error. ---------------------------------------------------------------------- wp · 2023-03-02 14:19 Sorry I don't know this package very well and was not aware that there is a pre-fabricated TKMemoFrame. But when I follow your instructions I do not get any error, the test application is compiling and running fine. I am using Laz-main/fpc-3.2.2 (32 bit) on Win 11 (64 bit). But then I repeated the same in Laz-2.2.4/fpc-3.2.2 (32bit and 64bit), and now I could see the issue. The problem seems to be that the frame's unit is not added to the uses clause. I did this (added "KMemoFrm") and compiled again - some error. Then I did a "Run" > "Build" -- now it worked. I think this issue has been reported in https://gitlab.com/freepascal.org/lazarus/lazarus/-/issues/40003 and has been fixed in Nov by Juha. ---------------------------------------------------------------------- Badger · 2023-03-03 00:24 That worked fine.  Displayed OK. I have found there are a few problems with the package. Problems with frame:- 1  Can't drag frame around the form in design mode 2  Can't print directly - if you go to print preview then print from there it works 3  Text Font in print preview and print is very large. Could someone test to make sure it isn't something I'm doing. If a bug, should it be addressed through lazarus bug report or try to contact the developer? ---------------------------------------------------------------------- dbannon · 2023-03-03 04:32 Badger, I use KMemo in my app. All I need to do is install KControls so that it appears on the Lazarus IDE components toolbar, click KMemo from that toolbar and click in a Form. No frames involved. You can pin the KMemo to the sides of the form in the usual way and it all scales nicely. I think you will  find KMemo's printing is Windows only (?), anyway, I did not use it.  See https://github.com/tomboy-notes/tomboy- ng/blob/master/source/k_prn.pas for my totally cross platform KMemo Print unit. Its Text only however, cannot handle embedded images because I don't do images in my app. You can report bugs direct to the KControls Github site, I have found TK very welcoming of bug reports and new features that contain fixes/patches. However, he has indicated that he is unwilling to much work on it himself so a bug report that just says something does not work as expected will probably not get much attention. Overall, I find KMemo an excellent product, takes a bit to get used to its way of working but once there, it really does work well. In my project, you will also find units to export a KMemo to markdown and PDF.  Another provides Ctrl Z / Y undo and redo. Might be useful. Davo ---------------------------------------------------------------------- Badger · 2023-03-03 06:27 QuoteBadger, I use KMemo in my app. All I need to do is install KControls so that it appears on the Lazarus IDE components toolbar, click KMemo from that toolbar and click in a Form. No frames involved.I need the added integrated toolbars that come with KMemoFrame. (Do what I told wp to do and have a look at the KMemoframe - it's extremely useful -  apart from the printing issues). QuoteI think you will  find KMemo's printing is Windows only (?), anyway, I did not use it.  See https://github.com/tomboy-notes/tomboy- ng/blob/master/source/k_prn.pas for my totally cross platform KMemo Print unit. Its Text only however, cannot handle embedded images because I don't do images in my app.Printing to Windows is what I need.  I'll look at your print unit if I may and, hopefully, it might help me find out why the Print button on kMemoframes doesn't work and why the printed text is so big. Unfortunately i need embedded images. QuoteYou can report bugs direct to the KControls Github site I'll see if I can track down the bugs before contacting TK. Quote Might be useful.Looking forward to having a look. ---------------------------------------------------------------------- wp · 2023-03-03 10:44 Quote from: Badger on March 03, 2023, 01:24:17 amI have found there are a few problems with the package. Problems with frame:- 1  Can't drag frame around the form in design mode Yes, that's a general problem with frames: When you click on it you may easily select the clicked component on the frame rather than the frame itself, in particular if there is no empty space on the frame. To select the frame itself, you can click on the frame node in the object tree, or you can click on any control on the frame and then press ESC until the frame itself is selected; then you can use CTRL+arrow or SHIFT+arrow to move/resize the frame by the keyboard. But being unable to drag the frame in a simple mode is one of the least problems when a frame is available in design mode. One of the worst problems is that you unintentionally can remove event handlers very easily. Therefore, it is highly recommended to never add frames at designtime, only by code at runtime. ---------------------------------------------------------------------- Badger · 2023-03-03 12:13 Thanks wp, before I start chasing down the print problem, could I ask you to just try the print button to see if it's something specific to my computer or not? ---------------------------------------------------------------------- wp · 2023-03-03 12:47 Quote from: Badger on March 03, 2023, 01:13:26 pmThanks wp, before I start chasing down the print problem, could I ask you to just try the print button to see if it's something specific to my computer or not? When I click the Print button in the toolbar I see the PageSetup dialog, and when I click Preview from here I can confirm that the font is awfully big. When I click the Print button here (I only printed to PDF) there is that huge font again. Maybe a scaling error, as if the Font.Size rather than the Font.Height were multiplied by the ppi ratio (Font.Size is in Points and the same physical size on all output devices) - that's what I'd be search for at first when I'd debug the component. The Hint of the Print button has an ellipsis at the end indicating that it will not print directly but opens an intermediate form - that's nice. The buttons in the toolbar seem to be quite screwed up: the Open button has the diskette icon which is normally used for the Save command, and the Save button has some hard-to-distinguish grayish icon which maybe looks like a harddisk - very unusual. I guess also that the toolbar icons do not follow the LCL high-dpi rules and will not scale with screen resolution. The forms have hard-coded windows forms which may cause issues or layout problems on other platforms. The PrintSetupForm does not use anchoring to align the controls, and it must be expected that it will cause layout issues (overlapping and truncated controls) on other platforms.