Re: When to create TCustomControl's child controls?



As I've demonstrated, you can use CreateWND, but then your dimensions
are 0 unless you've specified default values beforehand, which I did in
Create. The advantage of doing it this way is that those values are can
be automatically overridden when the control is streamed in, but are
still available should you choose dynamic creation.

Another, though clunky, method, is to use Paint as your common hook,
although you need a variable and a test for it in Paint, for example:

Type TMyControl = class(TCustomControl);
private
fControlInitialised : Boolean;
Procedure InitControl;
.
protected
Procedure Paint; override;
.
.
end;
..
..
..

Procedure TMyControl.Paint;
begin
if not fControlInitialized then InitControl;
..
..// do your painting as usual
..
end

Procedure TMyControl.InitControl;
begin
// create your objects and so on
.
.
fControlinitialised := true;

end;

As you can see it's not the most efficient way of doing it, although it
might be the most intuitive for novices.

.



Relevant Pages

  • Re: When to create TCustomControls child controls?
    ... are 0 unless you've specified default values beforehand, ... be automatically overridden when the control is streamed in, ... Another, though clunky, method, is to use Paint as your common hook, ... Procedure InitControl; ...
    (alt.comp.lang.borland-delphi)
  • Re: Gabriels Horn
    ... After all shouldn't the paint required ... of the similar fact that a curve in a bounded region can have ... Volumes are computed by multiplying three dimensions together, ...
    (sci.math)
  • Re: Horn of 1/X dilemma
    ... the surface area is infiinite. ... of paint, but it requires infinity gallons to paint it. ... Volumes are computed by multiplying three dimensions together, ...
    (sci.math)
  • Re: Painting tips for stencil apps on black cabs
    ... but it had dried for two days beforehand. ... epoxy based paint you used on your S&S, I certainly would not have had ... far, and like I said, the stencil material is top notch, nice stuff to ...
    (rec.games.pinball)
  • Re: slipstream
    ... Jonathan L Cunningham wrote: ... beforehand) will paint himself into a corner ... ...
    (rec.arts.sf.composition)

Loading