Difference between revisions of "KOL-CE"

From Free Pascal wiki
Jump to navigationJump to search
(→‎Introduction: corrections about the current status of KOL itself: it is very suitable (more so than kol-ce) for 32/64 bit development (as of KOL 3.22))
m (Move platform template to page template; remove categories already in page template)
(4 intermediate revisions by 3 users not shown)
Line 1: Line 1:
 
{{KOL-CE}}
 
{{KOL-CE}}
 +
 
==Introduction==
 
==Introduction==
KOL-CE is Free Pascal/Lazarus port of KOL&MCK devloped by Vladimir Kladov (http://kolmck.net). KOL-CE is developed by Yury Sidorov and distributed under [http://www.opensource.org/licenses/wxwindows.php wxWindows Library Licence].
+
 
 +
KOL-CE is Free Pascal/Lazarus port of KOL&MCK devloped by Vladimir Kladov (http://kolmck.ru). KOL-CE is developed by Yury Sidorov and distributed under [http://www.opensource.org/licenses/wxwindows.php wxWindows Library Licence].
  
 
KOL-CE allows to create very compact Win32/WinCE GUI applications (starting from ~40KB executable for project with empty form).
 
KOL-CE allows to create very compact Win32/WinCE GUI applications (starting from ~40KB executable for project with empty form).
Line 9: Line 11:
 
Initially 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.
 
Initially 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.
 
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.
 +
 
=== Requirements ===
 
=== Requirements ===
 +
 
* Free Pascal compiler 2.2.0 or later for Win32.
 
* Free Pascal compiler 2.2.0 or later for Win32.
 
* arm-wince cross compiler 2.2.0 or later for Win32 (for [[WinCE port|WinCE]] development).
 
* arm-wince cross compiler 2.2.0 or later for Win32 (for [[WinCE port|WinCE]] development).
Line 15: Line 19:
  
 
=== Supported targets ===
 
=== Supported targets ===
 +
 
* All 32-bit Windows: from Windows 95 to Windows 8.1.
 
* All 32-bit Windows: from Windows 95 to Windows 8.1.
 
* [[WinCE port|Windows CE]] based PocketPC and Smartphones.
 
* [[WinCE port|Windows CE]] based PocketPC and Smartphones.
  
 
== Download ==
 
== Download ==
 +
 
Download the latest release of KOL-CE [http://sourceforge.net/project/showfiles.php?group_id=188451 here].
 
Download the latest release of KOL-CE [http://sourceforge.net/project/showfiles.php?group_id=188451 here].
  
Line 24: Line 30:
  
 
== Installation ==
 
== Installation ==
 +
 
----
 
----
 
'''Important:''' Since KOL-CE 2.80.2 <tt>DisableFakeMethods</tt> define is not needed anymore.
 
'''Important:''' Since KOL-CE 2.80.2 <tt>DisableFakeMethods</tt> define is not needed anymore.
Line 49: Line 56:
  
 
== Using MCK ==
 
== Using MCK ==
 +
 
=== Creating MCK project ===
 
=== Creating MCK project ===
 +
 
[[Image:MCKForm.png|right|MCK form]]
 
[[Image:MCKForm.png|right|MCK form]]
 
# Start Lazarus and select '''File > New...''' menu item.
 
# Start Lazarus and select '''File > New...''' menu item.
Line 58: Line 67:
  
 
=== Adding a form ===
 
=== Adding a form ===
 +
 
# Select '''File > New...''' menu item.
 
# Select '''File > New...''' menu item.
 
# Choose '''KOL Form''' under '''File''' section and press '''OK''' button.
 
# Choose '''KOL Form''' under '''File''' section and press '''OK''' button.
Line 70: Line 80:
  
 
=== IMPORTANT ===
 
=== IMPORTANT ===
 +
 
To resolve conflict between words <tt>LCL.Self</tt> and <tt>KOL.@Self</tt>, which are interpreted differently in KOL and LCL, special field is introduced - <tt>Form</tt>. In LCL, <tt>Form</tt> property of <tt>TKOLForm</tt> component "returns" <tt>Self</tt>, i.e. form object itself. And in KOL, <tt>Form: PControl</tt> is a field of object, containing resulting form object. Since this, it is correctly to change form's properties in following way:  
 
To resolve conflict between words <tt>LCL.Self</tt> and <tt>KOL.@Self</tt>, which are interpreted differently in KOL and LCL, special field is introduced - <tt>Form</tt>. In LCL, <tt>Form</tt> property of <tt>TKOLForm</tt> component "returns" <tt>Self</tt>, i.e. form object itself. And in KOL, <tt>Form: PControl</tt> is a field of object, containing resulting form object. Since this, it is correctly to change form's properties in following way:  
 
  Form.Caption := 'Hello!';  
 
  Form.Caption := 'Hello!';  
Line 78: Line 89:
  
 
=== Run-time form creation ===
 
=== Run-time form creation ===
 +
 
It 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 <tt>NewForm1</tt> (replacing Form1 with your mirror form name), for instance:
 
It 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 <tt>NewForm1</tt> (replacing Form1 with your mirror form name), for instance:
 
  NewForm1( TempForm1, Applet );
 
  NewForm1( TempForm1, Applet );
Line 83: Line 95:
  
 
== WinCE ==
 
== WinCE ==
 +
 
====Setup====
 
====Setup====
 +
 
[[Image:arm-wince-target.png|right|arm-wince target]]
 
[[Image:arm-wince-target.png|right|arm-wince target]]
 
You need to install arm-wince cross compiler for Win32 to compile WinCE executables. Get it [http://www.freepascal.org/download.var here].
 
You need to install arm-wince cross compiler for Win32 to compile WinCE executables. Get it [http://www.freepascal.org/download.var here].
Line 101: Line 115:
  
 
====Hints and notes====
 
====Hints and notes====
 +
 
* 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.
 
* 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.
  
 
====Known issues====
 
====Known issues====
 +
 
* The following components are not supported: RichEdit.
 
* The following components are not supported: RichEdit.
 
* Transparency and double buffering are not supported.
 
* Transparency and double buffering are not supported.
Line 111: Line 127:
  
 
== Documentation ==
 
== Documentation ==
* Visit official KOL&MCK website for documentation and information: http://kolmck.net
+
 
 +
* Visit official KOL&MCK website for documentation and information: http://kolmck.ru
 
* Read MCK documentation in '''KOLmirrorReadme.txt''' file inside MCK folder.
 
* Read MCK documentation in '''KOLmirrorReadme.txt''' file inside MCK folder.
  
 
== KOL-CE in real-world applications ==
 
== KOL-CE in real-world applications ==
 +
 
* [http://www.cp-lab.com/windows-mobile.html Password Manager XP Mobile]
 
* [http://www.cp-lab.com/windows-mobile.html Password Manager XP Mobile]
 
* [http://blog.carolos.za.net/2007/05/charmed-for-pocket-pc-beta-030.html ChARMeD disassembler]
 
* [http://blog.carolos.za.net/2007/05/charmed-for-pocket-pc-beta-030.html ChARMeD disassembler]
Line 120: Line 138:
  
 
== See also ==
 
== See also ==
* [[KOL| The KOL main page]]
+
 
* Official KOL&MCK website http://kolmck.net
+
* [[KOL| The wiki page for KOL]]
 +
* Official KOL&MCK website http://kolmck.ru
 
* KOL-CE page at SourceForge http://sourceforge.net/projects/kol-ce/
 
* KOL-CE page at SourceForge http://sourceforge.net/projects/kol-ce/
 
* [[WinCE port|WinCE port of Free Pascal]]
 
* [[WinCE port|WinCE port of Free Pascal]]
Line 128: Line 147:
  
 
== Contacts ==
 
== Contacts ==
 +
 
Report bugs, submit patches and ask questions at project's page at SourceForge: http://sourceforge.net/projects/kol-ce/
 
Report bugs, submit patches and ask questions at project's page at SourceForge: http://sourceforge.net/projects/kol-ce/
 
[[Category:Components]]
 
[[Category:WinCE]]
 

Revision as of 02:31, 9 August 2020

Windows logo - 2012.svg

This article applies to Windows only.

See also: Multiplatform Programming Guide

WinCE Logo.png

This article applies to Windows CE only.

See also: Multiplatform Programming Guide

English (en) français (fr) 한국어 (ko) русский (ru) 中文(中国大陆)‎ (zh_CN) 中文(台灣)‎ (zh_TW)

Introduction

KOL-CE is Free Pascal/Lazarus port of KOL&MCK devloped by Vladimir Kladov (http://kolmck.ru). KOL-CE is developed by Yury Sidorov and distributed under wxWindows Library Licence.

KOL-CE allows to create very compact Win32/WinCE GUI applications (starting from ~40KB executable for project with empty form).

MCK is Lazarus package wich allows VISUAL development of KOL-CE projects in Lazarus IDE.

Initially KOL-CE was planned as KOL port for 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.

Requirements

  • Free Pascal compiler 2.2.0 or later for Win32.
  • arm-wince cross compiler 2.2.0 or later for Win32 (for WinCE development).
  • Lazarus 0.9.26 or later for Win32.

Supported targets

  • All 32-bit Windows: from Windows 95 to Windows 8.1.
  • Windows CE based PocketPC and Smartphones.

Download

Download the latest release of KOL-CE here.

Also you can check out the freshest KOL-CE sources from svn using this link: https://kol-ce.svn.sourceforge.net/svnroot/kol-ce/trunk

Installation


Important: Since KOL-CE 2.80.2 DisableFakeMethods define is not needed anymore.

If 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!

To do that:

  1. Run Lazarus.
  2. Choose Tools > Configure "Build Lazarus"... menu item.
  3. Choose Clean Up + Build all on Quick Build Options page.
  4. Open Advanced Build Options page and remove -dDisableFakeMethods from Options input field.
  5. Click Build button to rebuild Lazarus.

MCK package
  1. Download KOL-CE sources and put them on some folder on your filesystem.
  2. Run Lazarus and choose Components > Load package file menu item. Then navigate to MCK folder and choose MirrorKOLPackage.lpk file.
  3. Package window will appear. Press Install button.
  4. Lazarus will compile MCK package and IDE will be restarted.
  5. After restart KOL tab will appear on components palette.

KOL components palette

NOTE: 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).

MCK 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.

Using MCK

Creating MCK project

MCK form
  1. Start Lazarus and select File > New... menu item.
  2. Choose KOL Application under Project section and press OK button.
  3. New project for KOL application will be created.
  4. Save this project with desired name.
  5. Play with your new KOL/MCK Project (adjust parameters, drop TKOL... components, compile, run, debug, etc.) Enjoy!

Adding a form

  1. Select File > New... menu item.
  2. Choose KOL Form under File section and press OK button.
  3. Save new form with desired name.

Writing code

Do 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.

IMPORTANT

To 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:

Form.Caption := 'Hello!'; 

(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.:

Button1.Caption := 'OK';
Button1Click(Form);

Run-time form creation

It 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:

NewForm1( TempForm1, Applet );

To 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.

WinCE

Setup

arm-wince target

You need to install arm-wince cross compiler for Win32 to compile WinCE executables. Get it here.

To 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.

NOTE: You can receive the following error while compiling your KOL-CE project for WinCE:

Compiling resource KOL-CE.rc
arm-wince-windres.exe: no resources
KOL.PAS(57901) Error: Error while linking
KOL.PAS(57901) Fatal: There were 1 errors compiling module, stopping

In such case you need to edit Windows PATH environment variable and add path to folder where win32 fpc binaries are located.
To find out which path to add, go to Environment options in Lazarus and see compiler path.
Quit Lazarus before editing PATH.
To edit PATH variable right click on My Computer icon go to Advanced tab and click Environment Variables button.

Hints and notes

  • 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.

Known issues

  • The following components are not supported: RichEdit.
  • Transparency and double buffering are not supported.
  • Only gsVertical, gsHorizontal gradient panel styles are supported.
  • Horizontal text alignment does not work in single line edit control. Use memo if you need text alignment.
  • Vertical text alignment does not work for panel and label.

Documentation

  • Visit official KOL&MCK website for documentation and information: http://kolmck.ru
  • Read MCK documentation in KOLmirrorReadme.txt file inside MCK folder.

KOL-CE in real-world applications

See also

Contacts

Report bugs, submit patches and ask questions at project's page at SourceForge: http://sourceforge.net/projects/kol-ce/