[fpc-pascal] Assigning events in objects
Zitt Zitterkopf
zittware at hotmail.com
Wed Feb 3 19:01:37 CET 2010
All,
I'm writing a TurboVision App to cross compile to Linux - but debugging on my main Win32 box.
In this app; I'm attempting to use the TFPTimer component to trigger an event every 1000ms. I can't get the bugger to compile; despite google searches and a lot of experience in Delphi.
The compiler always seems to throw an error simular to:
TVBOOT.PAS(52,20) Error: Incompatible types: got "<procedure variable type of procedure(TObject) of object;Register>" expected "CLASSES.<procedure variable type of procedure(TObject) of object;Register>"
I began by using the advice of Graeme in the post:
http://readlist.com/lists/lists.freepascal.org/fpc-pascal/0/3897.html
I know this is simple compiler gymnastics; but I just can't seem to figure it out.
John
uses
CRT,App,Objects,Menus,Drivers,Views,Dialogs,
fpTimer;
type
TBootApp = object(TApplication)
private
aTimer : TfpTimer;
protected
constructor Init;
destructor Done; virtual;
procedure InitStatusLine; virtual;
procedure HandleEvent(var Event: TEvent); virtual;
procedure Idle; virtual;
function NewDialog : word;
public
procedure TimerTimer( Sender : TObject );
end;
PDemoDialog = ^TDemoDialog;
TDemoDialog = object(TDialog)
end;
var
BootApp : TBootApp;
Dialog : PDemoDialog;
DoDialog : Boolean;
constructor TBootApp.Init;
BEGIN
aTimer := TFPTimer.Create(nil);
aTimer.Interval := 500; //ms
aTimer.Enabled := False;
aTimer.OnTimer := @TimerTimer; //compiler barfs <<<---- here!
END;
destructor TBootApp.Done;
BEGIN
ATimer.Free;
END;
procedure TBootApp.TimerTimer( Sender : TObject );
BEGIN
END;
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20100203/459148aa/attachment.html>
More information about the fpc-pascal
mailing list