mekko
2006-06-13 04:22:40 UTC
Hi there,
the component I try to write contains a panel which itself contains 2
more panels. I need to be able to drop other components onto theses
nested panels at design time which works fine but at runtime the
components on the nested panels are gone...
I came across different solutions with the setsubcomponent method and
having the form as the owner of all the panels but these solutions
didn't really work out. A solution that worked fine for me for having
all sorts of components on the top panel in my component was
overwriting the getchildren and getchildparent methods as described
here:
http://groups.google.com.au/group/borland.public.delphi.vcl.components.writing/browse_thread/thread/24ed75778e94c0a/e08c80c7cfaf10e2?lnk=st&q=delphi+panel+getchildren&rnum=1&hl=en#e08c80c7cfaf10e2
I am sorry if this is a stupid question but this my first try to write
my own component and I am stuck now when trying to use this solution
for having more than 1 nested panel as the following (as suggested
under the link above) won't work anymore:
procedure TTestPanel.GetChildren(Proc: TGetChildProc; Root:
TComponent);
begin
FNestedPanel.GetChildren(Proc,Root);
end;
function TTestPanel.GetChildParent: TComponent; override;
begin
Result := FNestedPanel;
end;
I would think to have a loop within the getchildren procedure to call
getchildren for each of the nested panels as I saw in some solutions
for finsing components on a panel. But what do I do with the
getChildParent function when having 2 or more nested panels on the
"master" panel inside my component? The getChildParent method cannot
return FNestedPanel anymore as I don't know which nested panel should
be the parent when a component is dropped on any of my nested panels at
design time.
Many thanks for your help in advance!!!
the component I try to write contains a panel which itself contains 2
more panels. I need to be able to drop other components onto theses
nested panels at design time which works fine but at runtime the
components on the nested panels are gone...
I came across different solutions with the setsubcomponent method and
having the form as the owner of all the panels but these solutions
didn't really work out. A solution that worked fine for me for having
all sorts of components on the top panel in my component was
overwriting the getchildren and getchildparent methods as described
here:
http://groups.google.com.au/group/borland.public.delphi.vcl.components.writing/browse_thread/thread/24ed75778e94c0a/e08c80c7cfaf10e2?lnk=st&q=delphi+panel+getchildren&rnum=1&hl=en#e08c80c7cfaf10e2
I am sorry if this is a stupid question but this my first try to write
my own component and I am stuck now when trying to use this solution
for having more than 1 nested panel as the following (as suggested
under the link above) won't work anymore:
procedure TTestPanel.GetChildren(Proc: TGetChildProc; Root:
TComponent);
begin
FNestedPanel.GetChildren(Proc,Root);
end;
function TTestPanel.GetChildParent: TComponent; override;
begin
Result := FNestedPanel;
end;
I would think to have a loop within the getchildren procedure to call
getchildren for each of the nested panels as I saw in some solutions
for finsing components on a panel. But what do I do with the
getChildParent function when having 2 or more nested panels on the
"master" panel inside my component? The getChildParent method cannot
return FNestedPanel anymore as I don't know which nested panel should
be the parent when a component is dropped on any of my nested panels at
design time.
Many thanks for your help in advance!!!