Sign in Join
Wiki copytemporary

KOL-CE: what changed

Revision 2 to 3. Removed lines have a minus sign; added lines have a plus sign.

OldNewLine
11## Introduction
22
33KOL-CE is Free Pascal/Lazarus port of KOL&MCK devloped by Vladimir Kladov ([website](http://f0460945.xsph.ru/rindex.htm)). KOL-CE is developed by Yury Sidorov and distributed under [wxWindows Library Licence](http://www.opensource.org/licenses/wxwindows.php).
44
55KOL-CE allows to create very compact Win32/WinCE GUI applications (starting from ~40KB executable for project with empty form).
66
77MCK is Lazarus package wich allows VISUAL development of KOL-CE projects in Lazarus IDE.
88
99Initially KOL-CE was planned as KOL port for [[WinCE port|WinCE]] only. But later it was decided to keep Win32 functionality and made it work with FPC smoothly. The original MCK can not be used with Lazarus at all. The more current versions of [[KOL]] also work very well with FPC and targets both 32 and 64 bit applications, but do not include an MCK for Lazarus yet: you can use MCK from KOL-CE and recompile against the newer kol.pas version with some thought, but requires patching some of the Lazarus MCK generated sourcecode to reflect kol's current status.
1010
1111### Requirements
1212
1313- Free Pascal compiler 2.2.0 or later for Win32.
1414- arm-wince cross compiler 2.2.0 or later for Win32 (for [[WinCE port|WinCE]] development).
1515- Lazarus 0.9.26 or later for Win32.
1616
1717### Supported targets
1818
1919- All 32-bit Windows: from Windows 95 to Windows 8.1.
2020- [[WinCE port|Windows CE]] based PocketPC and Smartphones.
2121
2222## Download
2323
2424Download the latest release of KOL-CE [here](http://sourceforge.net/project/showfiles.php?group_id=188451).
2525
2626Also you can check out the freshest KOL-CE sources from svn using this link: <https://kol-ce.svn.sourceforge.net/svnroot/kol-ce/trunk>
2727
2828## Installation
2929
3030------------------------------------------------------------------------
3131
3232**Important:** Since KOL-CE 2.80.2 `DisableFakeMethods` define is not needed anymore.
3333
3434If you previously used KOL-CE 2.80.1 or older, you need to rebuild Lazarus **without** `DisableFakeMethods` define before installing MCK package. Otherwise **event handlers will not work**!
3535
3636To do that:
3737
38381. Run Lazarus.
39392. Choose **Tools \> Configure "Build Lazarus"...** menu item.
40403. Choose **Clean Up + Build all** on **Quick Build Options** page.
41414. Open **Advanced Build Options** page and **remove** `-dDisableFakeMethods` from **Options** input field.
42425. Click **Build** button to rebuild Lazarus.
4343
4444------------------------------------------------------------------------
4545
4646![](/wiki-images/2/2e/MirrorKOLPackage.png)
4747
48481. Download KOL-CE sources and put them on some folder on your filesystem.
49492. Run Lazarus and choose **Components \> Load package file** menu item. Then navigate to **MCK** folder and choose **`MirrorKOLPackage.lpk`** file.
50503. Package window will appear. Press **Install** button.
51514. Lazarus will compile MCK package and IDE will be restarted.
52525. After restart KOL tab will appear on components palette.
5353
5454![](/wiki-images/d/d1/KOLComponents.png)
5555
5656NOTE: If you can't see all KOL components on the palette, resize window with components palette vertically. You will see the second row of components on KOL tab (as on screenshot above).
5757
5858MCK package upgrade is very simple as well. Just overwrite KOL-CE sources with new version, open MCK package and press **Install** button to recompile the package.
5959
6060## Using MCK
6161
6262### Creating MCK project
6363
6464![](/wiki-images/0/04/MCKForm.png)
6565
66661. Start Lazarus and select **File \> New...** menu item.
67672. Choose **KOL Application** under **Project** section and press **OK** button.
68683. New project for KOL application will be created.
69694. Save this project with desired name.
70705. Play with your new KOL/MCK Project (adjust parameters, drop TKOL... components, compile, run, debug, etc.) Enjoy!
7171
7272### Adding a form
7373
74741. Select **File \> New...** menu item.
75752. Choose **KOL Form** under **File** section and press **OK** button.
76763. Save new form with desired name.
7777
7878### Writing code
7979
8080Do not use names from RTL/FCL/LCL, especially from SysUtils, Classes, Forms, etc. All what you need, you should find in KOL, Windows, Messages units. And may be, write by yourself (or copy from another sources). When you write code in mirror project - usually place it in event handlers. You also can add any code where you wish but avoid changing first section of your mirror LCL form class declaration. And do not change auto-generated inc-files. Always remember, that code, that you write in mirror project, must be accepted both by LCL and KOL. By LCL - at the stage of compiling mirror project (and this is necessary, because otherwise converting mirror project to reflected KOL project will not be possible). And by KOL - at the stage of compiling written code in KOL namespace.
8181
8282### IMPORTANT
8383
8484To resolve conflict between words `LCL.Self` and `KOL.@Self`, which are interpreted differently in KOL and LCL, special field is introduced - `Form`. In LCL, `Form` property of `TKOLForm` component "returns" `Self`, i.e. form object itself. And in KOL, `Form: PControl` is a field of object, containing resulting form object. Since this, it is correctly to change form's properties in following way:
8585
86-`Form.Caption := 'Hello!'; `
86+``` pascal
87+Form.Caption := 'Hello!';
88+```
8789
8890(Though old-style operator Caption := 'Hello!'; is compiled normally while converting mirror project to KOL, it will be wrong in KOL environment). But discussed above word `Form` is only to access form's properties - not its child controls. You access child controls and form event handlers by usual way. e.g.:
8991
90-`Button1.Caption := 'OK';`\
91-`Button1Click(Form);`
92+``` pascal
93+Button1.Caption := 'OK';
94+Button1Click(Form);
95+```
9296
9397### Run-time form creation
9498
9599It is possible to create several instances of the same form at run-time. And at least, it is possible to make form not AutoCreate, and create it programmatically when needed. Use global function `NewForm1` (replacing Form1 with your mirror form name), for instance:
96100
97-`NewForm1( TempForm1, Applet );`
101+```text
102+NewForm1( TempForm1, Applet );
103+```
98104
99105To make this possible, NEVER access global variable created in the unit during conversation, unless You know why You are doing so. Refer to Form variable instead.
100106
101107## WinCE
102108
103109#### Setup
104110
105111![arm-wince target](/wiki-images/5/5e/Arm-wince-target.png) You need to install arm-wince cross compiler for Win32 to compile WinCE executables. Get it [here](http://www.freepascal.org/download.var).
106112
107113To compile for arm-wince target open compiler options of your project using **Project \> Compiler options...** menu item. Open **Code** tab and change target platform to arm-wince.
108114
109115**NOTE:** You can receive the following error while compiling your KOL-CE project for WinCE:
110116
111-`Compiling resource KOL-CE.rc`\
112-`arm-wince-windres.exe: no resources`\
113-`KOL.PAS(57901) Error: Error while linking`\
114-`KOL.PAS(57901) Fatal: There were 1 errors compiling module, stopping`
117+```text
118+Compiling resource KOL-CE.rc
119+arm-wince-windres.exe: no resources
120+KOL.PAS(57901) Error: Error while linking
121+KOL.PAS(57901) Fatal: There were 1 errors compiling module, stopping
122+```
115123
116124In such case you need to edit Windows **PATH** environment variable and add path to folder where win32 fpc binaries are located.\
117125To find out which path to add, go to **Environment options** in Lazarus and see compiler path.\
118126**Quit Lazarus before editing PATH**.\
119127To edit **PATH** variable right click on **My Computer** icon go to **Advanced** tab and click **Environment Variables** button.
120128
121129#### Hints and notes
122130
123131- To make form fullscreen as most Pocket PC applications have, don't change the form position and size. If form size and/or position was changed the form will look like dialog with caption and close button. In MCK set **defaultSize** and **defaultPosition** of TKOLForm to True to make form fullscreen.
124132
125133#### Known issues
126134
127135- The following components are not supported: RichEdit.
128136- Transparency and double buffering are not supported.
129137- Only gsVertical, gsHorizontal gradient panel styles are supported.
130138- Horizontal text alignment does not work in single line edit control. Use memo if you need text alignment.
131139- Vertical text alignment does not work for panel and label.
132140
133141## Documentation
134142
135143- Visit official KOL&MCK website for documentation and information: <http://kolmck.ru>
136144- Read MCK documentation in **KOLmirrorReadme.txt** file inside MCK folder.
137145
138146## KOL-CE in real-world applications
139147
140148- [Password Manager XP Mobile](http://www.cp-lab.com/windows-mobile.html)
141149- [ChARMeD disassembler](http://blog.carolos.za.net/2007/05/charmed-for-pocket-pc-beta-030.html)
142150- [WMWifiRouter](http://www.jongma.org/WMWifiRouter/)
143151
144152## See also
145153
146154- [[KOL|The wiki page for KOL]]
147155- [Official KOL&MCK website](http://f0460945.xsph.ru/rindex.htm)
148156- KOL-CE page at SourceForge <http://sourceforge.net/projects/kol-ce/>
149157- [[WinCE port|WinCE port of Free Pascal]]
150158- [[Windows CE Interface]]
151159- [[Windows CE Development Notes]]
152160
153161## Contacts
154162
155163Report bugs, submit patches and ask questions at project's page at SourceForge: <http://sourceforge.net/projects/kol-ce/>
156164
157165---
158166*From the Free Pascal wiki, page "KOL-CE", as it stood on 2021-04-29 after a change by Seenkao, out of the wiki's dump of 2024-05-26. Copyright stays with the author who wrote it, according to the old wiki's [[Licensing]] page. If you have concerns about this material, [message the admin](/wiki-contact).*

Back to history