Foros Club Delphi

Foros Club Delphi (https://www.clubdelphi.com/foros/index.php)
-   OOP (https://www.clubdelphi.com/foros/forumdisplay.php?f=5)
-   -   como destruir toolbar creada por codigo? (https://www.clubdelphi.com/foros/showthread.php?t=31674)

kinteam1 14-05-2006 22:26:24

como destruir toolbar creada por codigo?
 
hola estoy creando una toolbar por codigo, pero nose komo destruirla, crearla la creo asi.

Código:

toolbar1 := TToolBar.Create(Self);
  ToolBar1.Parent := Self;
  toolbar1.Width:=161;
  toolbar1.Width:=240;
  ToolBar1.ShowCaptions := True;
  ToolBar1.Height := 40;

Como la puedo destruir????? hago en un buttonclick un toolbar1.destroy y me da error. saludos!

dec 14-05-2006 22:37:10

Hola,

¿De dónde sale "toolbar1"? ¿Dónde declaras esa variable?

En todo caso, echa un vistazo a la ayuda del método "Destroy" de "TObject":

Cita:

Do not call Destroy directly. Call Free instead. Free verifies that the object reference is not nil before calling Destroy.

(...)

Destroy should be implemented so that it calls Free on all subobjects created within the object’s constructor (that is, allocated by the constructor). Unlike Destroy, Free provides a safeguard when destroying objects that are nil.

kinteam1 15-05-2006 00:31:48

muchas gracias! lo he arreglado con un findcomponent('toolbar1').free; saludos!


La franja horaria es GMT +2. Ahora son las 23:20:57.

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi