At first I created two objects TMarbleHole and TMarbleBoard
Just for testing these new components I added the calculations as to where
each TMarbleHole should be placed in the parent's (TMarbleBoard) create
method
This worked well for a quick test, but now I would like to have the
positions and sizes of the TMarbleHoles resized and repositioned when the
parent TMarbleBoard is resized...
Two questions, first when I created lots of child components (TMarbleHole's)
in the parent's create (TMarbleBoard) I noticed that this was pretty
slow!!! - quite a lag time.
Second, where should I place the code to paint the children, at what
position, and what size... the position and size are really dependant upon
the parent's size...
Can someone point me in right direction?
Thanks,
--Raymond
Raymond J. Schappe
Isthmus Technology Solutions, LLC
______________________________________
Is the board already visible when you create the children? Even if it is not
you can probably speed up the total sequence by enclosing the creation of the
children in
DisableAlign;
try
...create children
finally
EnableAlign;
end;
> Second, where should I place the code to paint the children,
If you derive the children from TGraphicControl (which would be sensible) you
paint them in an overriden Paint method.
> at what position, and what size... the position and size are really
> dependant upon the parent's size...
Placing and sizing the children is the task of the board. Since it has to be a
TCustomControl descendent (needs a window handle to be able to host controls)
it has a Resize method which you can override. First call the inherited method
(which fires the OnResize event), then look at clientwidth and clientheigth,
iterate over the Controls array and size and position the children. The
operation will cause them to repaint themselves.
--
Peter Below (TeamB)
Use the newsgroup archives :
http://www.mers.com/searchsite.html
http://www.tamaracka.com/search.htm
http://groups.google.com
http://www.prolix.be
Thanks!!! That was exactly what I needed!
What I have done so far fits well... I just need to go a bit farther...<g>
Thanks,
-- Raymond
Raymond J. Schappe
Isthmus Technology Solutions, LLC
______________________________________
>
> Is the board already visible when you create the children? Even if it is
not
> you can probably speed up the total sequence by enclosing the creation of
the
> children in
>
> DisableAlign;
> try
> ...create children
> finally
> EnableAlign;
> end;
>
>