Lazarus
Programming => Packages and Libraries => KOL => Topic started by: mago on September 28, 2009, 05:25:51 am
-
:)Thanks for reading my question?
I have tested Wince_Kol from now.
First, I created kol project. and I did new kol form.
I put the kol button on form1.
I clicked kol button event and activated the space;
I writed the code like below.
The error I found
Unit1.pas(48, 24) Error: identifier not found "Myclass"
in Unit1
{ 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, uType;
{$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;
Form: PControl;
KOLForm1: TKOLForm;
KOLProject: TKOLProject;
procedure Button1Click(Sender: PObj);
procedure KOLForm1FormCreate(Sender: PObj);
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
{$IFDEF KOL_MCK}
{$I unit1_1.inc}
{$ENDIF}
{ TForm1 }
procedure TForm1.Button1Click(Sender: PObj);
begin
ShowMessage( MyClass^.member );
end;
procedure TForm1.KOLForm1FormCreate(Sender: PObj);
begin
end;
initialization
{$IFNDEF KOL_MCK} {$I unit1.lrs} {$ENDIF}
end.
unit uType;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils;
type
TMyClass = class(TObject)
fmember : String;
public
function dosomething: string; virtual;
published
property member : string read fMember write fMember;
end;
PMyClass = ^TMyClass;
implementation
var
MyClass : PMyClass;
procedure TMyClass.dosomething: string;
begin
fmember := 'ksg'+'nef';
end;
Initialization
MyClass := New(PMyClass);
MyClass^.dosomething;
end.
-
I solve this problem.
Please check the attached file - Image file.