Recent

Author Topic: KOL-CE - compact applications for WinCE  (Read 126302 times)

vice

  • New Member
  • *
  • Posts: 28
KOL-CE - compact applications for WinCE
« Reply #120 on: September 25, 2008, 01:23:26 pm »
My application is bad when I add a secondary form.

Why?

This is my code:

Cli.lpr

Code: [Select]

{ KOL MCK } // Do not remove this line!
{$DEFINE KOL_MCK}
{$ifdef FPC} {$mode delphi} {$endif}
program Cli;

uses
  KOL,
  Unit1, Unit2;

begin // PROGRAM START HERE -- Please do not remove this comment

{$IFNDEF LAZIDE_MCK} {$I Cli_0.inc} {$ELSE}

  Application.Initialize;
  Application.CreateForm(TForm1, Form1);
  Application.Run;

{$ENDIF}

end.


Unit1.pas

Code: [Select]

{ KOL MCK } // Do not remove this line!
{$DEFINE KOL_MCK}
{$ifdef FPC} {$mode delphi} {$endif}
unit Unit1;

interface

uses Windows, Messages, KOL {place your units here->}
{$IFDEF LAZIDE_MCK}, Forms, mirror, Classes, Controls, mckCtrls, mckObjs, Graphics;
{$ELSE} ; {$ENDIF}

type

  { TForm1 }

  {$I MCKfakeClasses.inc}
  {$IFDEF KOLCLASSES} TForm1 = class; PForm1 = TForm1; {$ELSE OBJECTS} PForm1 = ^TForm1; {$ENDIF CLASSES/OBJECTS}
  TForm1 = {$IFDEF KOLCLASSES}class{$ELSE}object{$ENDIF}({$IFDEF LAZIDE_MCK}TForm{$ELSE}TObj{$ENDIF})
    Button1: TKOLButton;
    Button2: TKOLButton;
    Form: PControl;
    KOLApplet1: TKOLApplet;
    KOLForm1: TKOLForm;
    KOLProject1: TKOLProject;
    MainMenu1: TKOLMainMenu;
    procedure N1Menu(Sender: PMenu; Item: Integer);
  private
    { private declarations }
  public
    { public declarations }
  end;

var
  Form1 {$IFDEF KOL_MCK} : PForm1 {$ELSE} : TForm1 {$ENDIF} ;

{$IFDEF KOL_MCK}
procedure NewForm1( var Result: PForm1; AParent: PControl );
{$ENDIF}

implementation

uses Unit2;

{$IFDEF KOL_MCK}
{$I unit1_1.inc}
{$ENDIF}

{ TForm1 }

procedure TForm1.N1Menu(Sender: PMenu; Item: Integer);
var
 Modal: PForm2;
begin
 NewForm2( Modal, Applet );
 try
  Modal.Form.ShowModal;
 finally
  Modal.Form.Free;
 end;
end;

initialization
{$IFNDEF KOL_MCK} {$I unit1.lrs} {$ENDIF}

end.


Unit2.pas

Code: [Select]

{ KOL MCK } // Do not remove this line!
{$DEFINE KOL_MCK}
{$ifdef FPC} {$mode delphi} {$endif}
unit Unit2;

interface

uses Windows, Messages, KOL {place your units here->}
{$IFDEF LAZIDE_MCK}, Forms, mirror, Classes, Controls, mckCtrls, mckObjs, Graphics;
{$ELSE} ; {$ENDIF}

type

  { TForm2 }

  {$I MCKfakeClasses.inc}
  {$IFDEF KOLCLASSES} TForm2 = class; PForm2 = TForm2; {$ELSE OBJECTS} PForm2 = ^TForm2; {$ENDIF CLASSES/OBJECTS}
  TForm2 = {$IFDEF KOLCLASSES}class{$ELSE}object{$ENDIF}({$IFDEF LAZIDE_MCK}TForm{$ELSE}TObj{$ENDIF})
    Button1: TKOLButton;
    Form: PControl;
    KOLForm1: TKOLForm;
    procedure Button1Click(Sender: PObj);
  private
    { private declarations }
  public
    { public declarations }
  end;

var
  Form2 {$IFDEF KOL_MCK} : PForm2 {$ELSE} : TForm2 {$ENDIF} ;

{$IFDEF KOL_MCK}
procedure NewForm2( var Result: PForm2; AParent: PControl );
{$ENDIF}

implementation

{$IFDEF KOL_MCK}
{$I unit2_1.inc}
{$ENDIF}

{ TForm2 }

procedure TForm2.Button1Click(Sender: PObj);
begin
  Form.Close;
end;

initialization
{$IFNDEF KOL_MCK} {$I unit2.lrs} {$ENDIF}

end.

yuriy_sydorov

  • Full Member
  • ***
  • Posts: 158
KOL-CE - compact applications for WinCE
« Reply #121 on: September 25, 2008, 02:15:40 pm »
Did you remove form2 from autocreation list?
Did you set defaultSize and defaultPosition properties to True for form2?

vice

  • New Member
  • *
  • Posts: 28
KOL-CE - compact applications for WinCE
« Reply #122 on: September 25, 2008, 02:42:11 pm »
Quote from: "yury_sidorov"
Did you remove form2 from autocreation list?


Yes

Quote from: "yury_sidorov"
Did you set defaultSize and defaultPosition properties to True for form2?


No. That was the problem, thanks.

vice

  • New Member
  • *
  • Posts: 28
KOL-CE - compact applications for WinCE
« Reply #123 on: September 25, 2008, 03:49:58 pm »
Whithout KOL-CE componentes I normally use a TDataModule and I access to its properties, methods and attributes by means of the DataModule1 variable.

Which is the correct way to use a TKOLDataModule?

Best regards.

vice

  • New Member
  • *
  • Posts: 28
KOL-CE - compact applications for WinCE
« Reply #124 on: September 26, 2008, 01:37:16 am »
If I put a lNet component onto KOL-CE application I get the run-time error: Project raised exception class 'External: SIGSEGV'.

Why?

Legolas

  • Full Member
  • ***
  • Posts: 117
    • http://itaprogaming.free.fr
Re: RE: Events lost when transferring sources to other PC
« Reply #125 on: September 30, 2008, 01:24:40 pm »
Quote from: "yury_sidorov"
If you are using Lazarus 0.9.25 or later you need to rebuld Lazarus with DisableFakeMethods defined before installing MCK package.

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 add -dDisableFakeMethods into Options input field.
   5. Click Build button to rebuild Lazarus.


Although I have followed these steps, I can't get events working at design time. However, adding events on form create, they are fired :?:


EDIT
The patch provided here solves the problem after a Lazarus rebuild

vice

  • New Member
  • *
  • Posts: 28
lNet: I can´t assign callbacks
« Reply #126 on: December 09, 2008, 10:20:12 pm »
I can´t assign callbacks in the unit DataModule.pas, I get the error: datamodule.pas(48,28) Error: Variable identifier expected

The problem is in the KOLForm3BeforeCreateWindow method of the datamodule unit.

This is my code:

Code: [Select]
{ KOL MCK } // Do not remove this line!
{$DEFINE KOL_MCK}
{$ifdef FPC} {$mode delphi} {$endif}
unit DataModule;

interface

uses Windows, Messages, KOL {place your units here->}, lNet
{$IFDEF LAZIDE_MCK}, Forms, mirror, Classes, Controls, mckCtrls, mckObjs, Graphics;
{$ELSE} ; {$ENDIF}

type
  { TForm3 }
  {$I MCKfakeClasses.inc}
  {$IFDEF KOLCLASSES} TForm3 = class; PForm3 = TForm3; {$ELSE OBJECTS} PForm3 = ^TForm3; {$ENDIF CLASSES/OBJECTS}
  TForm3 = {$IFDEF KOLCLASSES}class{$ELSE}object{$ENDIF}({$IFDEF LAZIDE_MCK}TForm{$ELSE}TObj{$ENDIF})
    Form: PControl;
    KOLForm3: TKOLForm;
    procedure KOLForm3BeforeCreateWindow(Sender: PObj);
    procedure OnDs(aSocket: TLSocket);
    procedure OnRe(aSocket: TLSocket);
    procedure OnEr(const msg: string; aSocket: TLSocket);
  private
    { private declarations }
  public
    { public declarations }
    Conexion: TLTcp;
  end;

var
  Form3 {$IFDEF KOL_MCK} : PForm3 {$ELSE} : TForm3 {$ENDIF} ;

{$IFDEF KOL_MCK}
procedure NewForm3( var Result: PForm3; AParent: PControl );
{$ENDIF}

implementation

{$IFDEF KOL_MCK}
{$I datamodule_1.inc}
{$ENDIF}

{ TForm3 }

procedure TForm3.KOLForm3BeforeCreateWindow(Sender: PObj);
begin
  Conexion := TLTCP.Create(nil); // create new TCP connection with no parent component
  Conexion.OnError := @OnEr; // assign callbacks
  Conexion.OnReceive := @OnRe;
  Conexion.OnDisconnect := @OnDs;
  Conexion.Timeout := 100; // responsive enough, but won't hog cpu
  ShowMessage('Componente para la conexión creado');
end;

procedure TForm3.OnDs(aSocket: TLSocket);
begin
  ShowMessage('Lost connection');
end;

procedure TForm3.OnRe(aSocket: TLSocket);
var
  s: string;
begin
  if aSocket.GetMessage(s) > 0 then
    ShowMessage(s);
end;

procedure TForm3.OnEr(const msg: string; aSocket: TLSocket);
begin
  ShowMessage(msg); // if error occured, write it
end;

initialization
{$IFNDEF KOL_MCK} {$I datamodule.lrs} {$ENDIF}

end.


The solution:

Delphi mode is used for MCK generated source files.

Assign event without @

Conexion.OnError := OnEr;

jabu

  • New Member
  • *
  • Posts: 14
KOL and VGA support
« Reply #127 on: December 16, 2008, 07:54:55 pm »
Hello Yury,

do you have any news on VGA support on KOL-CE that you mention on 12th Nov?

regards

jabu

alepio

  • New Member
  • *
  • Posts: 23
Re: KOL-CE - compact applications for WinCE
« Reply #128 on: January 03, 2009, 11:24:06 am »
Sorry,
It don't work.
This is my error:
Quote
Compiling resource C:\Documents and Settings\lisa\Documenti\_LAZARUS\kol-ce-2.80.2\KOL-CE\kol\KOL-CE.rc
C:\lazarus\fpc\2.2.2\bin\i386-win32\arm-wince-windres.exe: no resources
C:\Documents and Settings\lisa\Documenti\_LAZARUS\kol-ce-2.80.2\KOL-CE\kol\KOL.PAS(57970) Error: Error while linking
C:\Documents and Settings\lisa\Documenti\_LAZARUS\kol-ce-2.80.2\KOL-CE\kol\KOL.PAS(57970) Fatal: There were 1 errors compiling module, stopping
I read all Documentation and add this PATH in the Env. System.
Quote
c:\lazarus\fpc\2.2.2\source\;c:\lazarus\fpc\;C:\lazarus\fpc\2.2.2\bin\i386-win32\;C:\Documents and Settings\lisa\Documenti\_LAZARUS\kol-ce-2.80.2\KOL-CE\kol;C:\Documents and Settings\lisa\Documenti\_LAZARUS\kol-ce-2.80.2\KOL-CE\mck;C:\Documents and Settings\lisa\Documenti\_LAZARUS\kol-ce-2.80.2\KOL-CE\mck\lib\i386-win32;C:\Documents and Settings\lisa\Documenti\_LAZARUS\kol-ce-2.80.2\KOL-CE\mck\lib\arm-wince;C:\Documents and Settings\lisa\Documenti\_LAZARUS\kol-ce-2.80.2\KOL-CE\kol

someone can help me?

Legolas

  • Full Member
  • ***
  • Posts: 117
    • http://itaprogaming.free.fr
Re: KOL-CE - compact applications for WinCE
« Reply #129 on: January 03, 2009, 08:17:38 pm »
Sorry,
It don't work.
This is my error:
Quote
Compiling resource C:\Documents and Settings\lisa\Documenti\_LAZARUS\kol-ce-2.80.2\KOL-CE\kol\KOL-CE.rc
C:\lazarus\fpc\2.2.2\bin\i386-win32\arm-wince-windres.exe: no resources
C:\Documents and Settings\lisa\Documenti\_LAZARUS\kol-ce-2.80.2\KOL-CE\kol\KOL.PAS(57970) Error: Error while linking
C:\Documents and Settings\lisa\Documenti\_LAZARUS\kol-ce-2.80.2\KOL-CE\kol\KOL.PAS(57970) Fatal: There were 1 errors compiling module, stopping
I read all Documentation and add this PATH in the Env. System.
Quote
c:\lazarus\fpc\2.2.2\source\;c:\lazarus\fpc\;C:\lazarus\fpc\2.2.2\bin\i386-win32\;C:\Documents and Settings\lisa\Documenti\_LAZARUS\kol-ce-2.80.2\KOL-CE\kol;C:\Documents and Settings\lisa\Documenti\_LAZARUS\kol-ce-2.80.2\KOL-CE\mck;C:\Documents and Settings\lisa\Documenti\_LAZARUS\kol-ce-2.80.2\KOL-CE\mck\lib\i386-win32;C:\Documents and Settings\lisa\Documenti\_LAZARUS\kol-ce-2.80.2\KOL-CE\mck\lib\arm-wince;C:\Documents and Settings\lisa\Documenti\_LAZARUS\kol-ce-2.80.2\KOL-CE\kol

someone can help me?

You have installed kol-ce in a folder with spaces ("C:\Documents and Settings\lisa\Documenti\_LAZARUS\kol-ce-2.80.2\"). Try to put all kol-ce stuff in a folder without spaces.

alepio

  • New Member
  • *
  • Posts: 23
Re: KOL-CE - compact applications for WinCE
« Reply #130 on: January 06, 2009, 10:53:13 am »
Now Work.
Thank you

chrgra

  • Jr. Member
  • **
  • Posts: 69
Re: KOL-CE - compact applications for WinCE
« Reply #131 on: January 18, 2009, 03:25:28 pm »
I thought I understand Kolce, but when I use  2.80.2

I make a new application but the onshow event of kolform is nog fired.
Other events like onbutton click does work.

Lazarus 9.2.7 fpc 2.2.3

I added also an example in test2.zip

Dibo

  • Hero Member
  • *****
  • Posts: 1048
Re: KOL-CE - compact applications for WinCE
« Reply #132 on: January 19, 2009, 10:36:01 am »
My exe with empty form have 180kB. Why? Strip.exe doesn't help.

oranke

  • New member
  • *
  • Posts: 8
    • Really poor developer...
Re: KOL-CE - compact applications for WinCE
« Reply #133 on: January 28, 2009, 04:19:25 pm »
......
I make a new application but the onshow event of kolform is nog fired.
Other events like onbutton click does work.
......

I have same problem. So I forced "Form.Show" on "OnFormCreate" event:


procedure TForm1.KOLForm1FormCreate(Sender: PObj);
begin
  Form.Visible := false;
  Form.CreateWindow;
  Form.Show;
end;


and It works fine~ :)

yuriy_sydorov

  • Full Member
  • ***
  • Posts: 158
Re: KOL-CE - compact applications for WinCE
« Reply #134 on: January 30, 2009, 04:17:38 pm »
I make a new application but the onshow event of kolform is nog fired.
Other events like onbutton click does work.

Please report bugs on KOL-CE project page on sourceforge: http://sourceforge.net/projects/kol-ce

 

TinyPortal © 2005-2018