I use the code post here sometimes ago but it stop on compiling at the red line saying "Duplicate frmhandleevent":
Why and how can I fix it?
Thank you very much
{$r FirstDA.rsrc} {$code DAcc,DA01,code,1000} // DA01 est le CreatorID
Program FirstDA; {$i PalmAPI.pas} Const FORM1=1000;
function FrmHandleEvent(formP:FormPtr;var event:EventType):boolean;inline(SYSTRAP,$A17A); procedure EvtAddEventToQueue(const event:EventType);inline(SYSTRAP,$A11B);
function HandleEvent(var evt:EventType):boolean; var frmP : FormPtr; begin frmP:=FrmGetActiveForm; HandleEvent:=false;
case evt.eType of
appStopEvent: begin EvtAddEventToQueue(evt); HandleEvent:=true; end;
ctlSelectEvent: begin WinDrawChars('Hello World !',13,20,20); end;
penDownEvent: begin if (evt.ScreenX<1) or (evt.ScreenX>100) or (evt.ScreenY<1) or (evt.ScreenY>80) then HandleEvent:=true; end; end; end;
procedure AppEventLoop; var evt : EventType; done : boolean; begin repeat EvtGetEvent(evt,evtWaitForever); if not SysHandleEvent(evt) then if not FrmHandleEvent(FrmGetActiveForm,evt) then done:=HandleEvent(evt); until (evt.eType=appStopEvent) or (done=true); end;
Var form:FormPtr; evt : EventType; begin
form := FrmInitForm(FORM1); FrmSetActiveForm(form); FrmDrawForm(form);
AppEventLoop;
FrmEraseForm(form); FrmDeleteForm(form);
end. enotar
|