sebmime
Messages postés11Date d'inscriptionmardi 23 mars 2004StatutMembreDernière intervention 8 septembre 2004
-
12 mai 2004 à 13:16
sebmime
Messages postés11Date d'inscriptionmardi 23 mars 2004StatutMembreDernière intervention 8 septembre 2004
-
13 mai 2004 à 10:30
Bonjour,
J'ai implémenté en Delphi une classe qui contient un TShape :
TCase = class(TGraphicControl)
private
rect : TShape; //apparence graphique de l'étape
public
constructor Create(AOwner: TComponent); override;
end;
procedure TCase.Create(AOwner:TComponent);
begin
...
rect := TShape.Create(AOwner);
rect.Parent := AOwner;
...
end;
Je veux ensuite afficher "rect" sur une TForm.
Ceci ne marche pas car rect.Parent attend un TWidgetControl. J'ai essayé plusieurs solutions et je n'ai pas trouvé comment faire pour qu'il n'y ait pas d'erreur
Que dois-je faire pour que cela marche, je ne vois pas ?
cs_Delphiprog
Messages postés4297Date d'inscriptionsamedi 19 janvier 2002StatutMembreDernière intervention 9 janvier 201332 12 mai 2004 à 19:25
Dans le cas d'une application Win32, un composant a besoin d'un TWinControl comme propriétaire.
Je me suis donc dit qu'il devait avoir besoin d'un TWidgetControl dans le cas d'une application CLX !
Bingo ! :big)
constructor TCase.Create(AOwner: TComponent);
begin
inherited;
rect := TShape.Create(AOwner);
rect.Parent := AOwner as TWidgetControl;
end;
Vérification faite, c'est exactement ce que ton composant attendait.
May Delphi be with you