Please enable JavaScript to view this site.

KOL/MCK - User Guide

Now that the newly created MCK project is open, you can try to compile it and run it. As usual, press the green arrow on the Delphi toolbar, or press the F9 key.

 

Did not work out? Probably, it is necessary to register the path to the KOL.pas file in the project options. In the Delphi menu, select: Project | Options, then on the Directories / Conditionals tab, find the Search Paths field, enter C: \ KOL here - well, or the path where you "installed" the KOL library.

The project should compile and run, and the form should appear. So far, there is nothing on it, of course. The form window can be moved, resized, minimized, and then closed.

 

Look in the project folder (to do this quickly, you can right-click on the TKOLProject component and select the Open Project Folder menu item - it is almost at the very top of the list), and select the assembled executable file. See what the size of the executable file is. You can see that the size is small enough compared to a single-shape project that is obtained in VCL (I now have 22 Kilobytes). You can make it even smaller right now if you have already downloaded and unpacked the files to replace system modules in a folder (for Delphi 7: https://www.artwerp.be/kol/sysdcu7.zip). Open the project options (Project | Options) and in the Directories / Conditionals tab in the Search Paths field, add (separated by semicolons) the path to this folder. Now the project needs to be rebuilt (Project | Build). Now see what happened to the size of the exe file.

 

Perhaps there is a little more that can be done to demonstrate the potential for size savings. If right now, select the TKOLForm component on the form, and change the values ​​of the defaultPosition and defaultSize properties to true in the Object Inspector, add a couple more symbols to the list of conditional compilation symbols, separated by a semicolon after the KOL_MCK symbol available there: SMALLEST_CODE and NOT_USE_RICHEDIT, then I get 13.5 Kilobytes. And what's great is that the resulting executable file can be compressed using a compression utility such as UPX or AsPack up to 8.5 Kbytes, i.e. in about the same ratio (by a third) as a large VCL project.

 

Next, let's adjust the shape. If we just want to change its size or position, then to change these parameters of the form during development, we should proceed as usual, i.e. grab the mouse, and resize the form. Yes, the corresponding properties defaultSize and defaultPosition will have to be set back to false if you are not satisfied with the system defaults.

 

pointing-up-finger

All other form properties should now be configured through the TKOLForm component... If you select a form, as you did in a VCL project, and try to change some property, like Caption, or something else, it will not affect the form in any way when it starts. So, here's rule # 1: to change the properties of a form in MCK, you need to select the TKOLForm component and change the required properties in it (the same Caption).

 

pointing-up-finger

Now you can customize the form however you want. MCK will generate code in the Uni1_1.inc module (this is where the code for initializing the form, automatically generated by the MCK components, is located). There is usually no need to load this module into the IDE editor.

And in any case, do not try to fix anything manually in this inc file.: such fixes will survive only until the next change in any of the properties of any MCK component, after which a new version of the form initialization code will be generated, and your work on fixing will disappear without a trace.

 

 

If you need to add some code of your own in the initialization of the form, you can do this in the event handler OnFormCreate, OnBeforeCreateWindow, or in OnShow. Note that if some code in the OnShow event handler needs to run once, you must ensure that OnShow is called the first time. For example, set up your own boolean variable OnShow_Fired, which should be set to true after the first execution of OnShow, and set the appropriate check.

 
if not OnShow_Fired then 
begin
 // code that will work 
 // only in the first call to OnShow
end;
OnShow_Fired: = true;
 

Be aware in the OnFormCreate "event" handler that window handles may still not exist for form visuals. In the OnBeforeCreateWindow "event" handler, window handles are not guaranteed to exist. And some objects may not be created as objects at this moment (i.e. pointers to them still contain nil, and an attempt to access their properties, methods, fields will lead to the crash of the application in this case). Those. you need to add the appropriate checks to your handlers code.

 

KOL / MCK User Guide - Created by Carl Peeraer - Diamant Soft, based on the work of Vladimir Kladov - Artwerp.be

  

Keyboard Navigation

F7 for caret browsing
Hold ALT and press letter

This Info: ALT+q
Nav Header: ALT+n
Page Header: ALT+h
Topic Header: ALT+t
Topic Body: ALT+b
Exit Menu/Up: ESC