[Lazarus] why handle is 0?

FreeMan freeman35 at delphiturkiye.com
Thu Dec 11 12:43:48 CET 2014


Self_Handle: HWND;
I added this variable, and set "Self_Handle := Self.Handle;" in 
component "loaded" event, create still have not handle!


Loaded;> 1 Self_Handle >140091380829392 Self.Handle >140091380829392
UpdateTimer;FTimerID > 1 : Self.Handle >140091380829392
TMainIDE.DoFixupComponentReferences UNRESOLVED BEFORE loading 0 
Root=FRM_Appointment:TFRM_Appointment RefRoot=DM Refs="MainConn"
Destroy;> 1 Self_Handle >140091380829392
Destroy;FTimerID > 1 : Self.Handle >0 Self_Handle >140091380829392
Destroy; FTimerID > 1 : Self.Handle >0 Self_Handle >140091380829392 
Killed>True _*<--- timer has to killed or widgetset say lie :)*_
Destroy;> 2
Destroy;> 99 <-- component destroyed last line

reopen form, ofcourse handle changed, but(FTimerID) SetTimer return 2 at 
this time?

Loaded;> 1 Self_Handle >140091456299056 Self.Handle >140091456299056
UpdateTimer;FTimerID > 2 : Self.Handle >140091456299056
TMainIDE.DoFixupComponentReferences UNRESOLVED BEFORE loading 0 
Root=FRM_Appointment:TFRM_Appointment RefRoot=DM Refs="MainConn"
Destroy;> 1 Self_Handle >140091456299056
Destroy;FTimerID > 2 : Self.Handle >0 Self_Handle >140091456299056
Destroy; FTimerID > 2 : Self.Handle >0 Self_Handle >140091456299056 
Killed>False _*<-- at this time can NOT killed timer so problem start*_  
"B := KillTimer(*Self_Handle*, FTimerID);"
Destroy;> 2
Destroy;> 99
QCoreApplication::postEvent: Unexpected null receiver
QCoreApplication::postEvent: Unexpected null receiver
QCoreApplication::postEvent: Unexpected null receiver



On 11-12-2014 13:09, FreeMan wrote:
> If I'm not wrong I found my bug in the 4. day
>
> Component has :
> procedure LMTimer(var Message: TLMTimer); message LM_TIMER;
>
> here is hold to timerevent
> ....
> var B : boolean;
> begin
>   if csLoading in ComponentState then Exit;
>   if (FTimerID = 0) then begin
>     FTimerID := SetTimer(Self.Handle, 1, 500, nil); <-- start
>    DebugLn(['UpdateTimer;FTimerID > ', FTimerID, ' : Self.Handle >', 
> Self.Handle]);
>   end;
> ....
>
> here is destroy event of component
> var B : Boolean;
> begin
>   DebugLn(['Destroy;> ', 1]); //destroy started
>   if (FTimerID <> 0) then begin
>    DebugLn(['Destroy;FTimerID > ', FTimerID, ' : Self.Handle >', 
> Self.Handle]);
>     B := KillTimer(Self.Handle, FTimerID);
>    DebugLn(['Destroy; FTimerID > ', FTimerID, ' : Self.Handle >', 
> Self.Handle, ' Killed>', B]);
>     FTimerID := 0;
>   end;
>   DebugLn(['Destroy;> ', 2]);//destroy ended
>
>
> and this is debug lines:
>
> UpdateTimer;FTimerID > 1 : Self.Handle >_*140042733101744*_
> TMainIDE.DoFixupComponentReferences UNRESOLVED BEFORE loading 0 
> Root=FRM_Appointment:TFRM_Appointment RefRoot=DM Refs="MainConn"
> Destroy;> 1
> Destroy;FTimerID > 1 : Self.Handle >_*0*_
> Destroy; FTimerID > 1 : Self.Handle >_*0 *_Killed>False
> Destroy;> 2
>
>
> where is my handle ? why its "0" if its come 0 howto access self 
> handle so access then childs?
>
>
>
> --
> _______________________________________________
> Lazarus mailing list
> Lazarus at lists.lazarus.freepascal.org
> http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20141211/94c8ec78/attachment-0003.html>


More information about the Lazarus mailing list