Discussion:
Compound components (Panels inside Panels)?!
(too old to reply)
mekko
2006-06-13 04:22:40 UTC
Permalink
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!!!
mekko
2006-06-13 04:46:07 UTC
Permalink
hey, I forgot to mention that I use Delphi 6.
Post by mekko
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
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
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!!!
Riki Wiki
2006-06-16 19:38:33 UTC
Permalink
Hoi Mekko

You need to repost your question on the Borland news server to make
everybody see it and possibly answer your question. Further, this news
group do not officially exist, the group to use is
b.p.d.vcl.components.writing.win32.

How to post to Delphi newsgroups:
<http://delphi.wikia.com/wiki/Delphi_Newsgroups>

Loading...