[DUG] Custom component and popup menu
Robert martin
rob at chreos.co.nz
Wed May 19 10:16:23 NZST 2010
Hi All
I am building a custom Tlistview that simply has a popupmenu with some
options. The concept was that if the component didn't have a Popupmenu
assigned one would be created otherwise the items would be added to the
existing menu component.
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 ''.
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 :)
Thanks Rob
More information about the Delphi
mailing list