Title: Robert Martin
Hi Paul

Put it in loaded at it works like a charm.  Thanks for the help :)

Rob
 

 


On 19/05/2010 10:33 a.m., Paul Heinz wrote:
Hi Rob

  
I have some code in my constructor (override)

inherited;

fInternalPopupMenu  := nil

if ((csDesigning in ComponentState) = False) then begin
         CreateMenu;
end;

This code runs fine however my component ALWAYS thinks their 
is no popup assigned so always assigns one.  Stepping through 
the code at runtime the Createmenu function is called but the 
component shows popupmenu as nil (even though it has been 
assigned at design time), self.Name even shows as ''.
    
The object constructors are called by definition _before_ any properties
are streamed in so yes, PopupMenu and Name will always both be unset at
this point.

  
I tried moving this to the onMouseDown event but the assigned 
popup, pops up before the event triggers (robbing me the 
opportunity to add my extra options).

Any suggestions on how to do this would be appreciated :)
    
Without knowing more context, I would suggest a Loaded method override
which is called once all properties are streamed in.

Cheers,
  Paul.


_______________________________________________
NZ Borland Developers Group - Delphi mailing list
Post: delphi@delphi.org.nz
Admin: http://delphi.org.nz/mailman/listinfo/delphi
Unsubscribe: send an email to delphi-requ...@delphi.org.nz with Subject: unsubscribe

  
_______________________________________________
NZ Borland Developers Group - Delphi mailing list
Post: delphi@delphi.org.nz
Admin: http://delphi.org.nz/mailman/listinfo/delphi
Unsubscribe: send an email to delphi-requ...@delphi.org.nz with Subject: 
unsubscribe

Reply via email to