Club Delphi  
    FTP   CCD     Buscar   Trucos   Trabajo   Foros

Retroceder   Foros Club Delphi > Principal > OOP
Registrarse FAQ Miembros Calendario Guía de estilo Temas de Hoy

Grupo de Teaming del ClubDelphi

 
 
Herramientas Buscar en Tema Desplegado
  #1  
Antiguo 21-12-2007
harpo harpo is offline
Miembro
 
Registrado: jul 2006
Posts: 35
Poder: 0
harpo Va por buen camino
Problema con borrado de componentes creados en tiempo de ejecución

Buenas,
Estoy tratando de hacer una aplicación en la que necesito crear y eliminar frames en tiempo de ejecución.

Código:
procedure TfrViewPatient.frEnter;
begin
  studyList:=TObjectList.Create;
end;

procedure TfrViewPatient.frExit;
begin
  studyList.Free;    
end;

procedure TfrViewPatient.AddStudy(study:TStudy);
var
  studyFrame: TfrStudy;
begin
  try
    studyFrame:=TfrStudy.Create(self);
    studyFrame.Parent:= ScrollBox;
    studyFrame.Name:='frStudy'+IntToStr(studyList.Count+1);
    studyFrame.IO.LoadFromFile('Images\1\1\000006.jpg');
    studyFrame.PanelStudy.OnClick:=FrStudyOnClick;
    Controller.RegisterListener(MSG_STUDY_CLICK,StudyClick);
    studyList.Add(studyFrame);

  except
    ShowMessage('Error creating study');
    Exit;
  end;
end;

procedure TfrViewPatient.StudyClick(Sender:TObject);
begin
  //todo: enter stViewStudy
  states.Enter(stViewStudy);  <-- aquí el error
end;

procedure TfrViewPatient.FrStudyOnClick(Sender:TObject);
begin
  Controller.Send(TMessage.Create(MSG_STUDY_CLICK,self,false));
end;

//todo: eliminar...
procedure TfrViewPatient.BitBtn1Click(Sender: TObject);
var
  study: TStudy;
begin
  AddStudy(study);  
end;

end.
La parte de Controller.RegisterListener(MSG_STUDY_CLICK,StudyClick); es irrelevante. Utilizo un controlador de eventos para lanzarlos en otros threats. Igualmente, utilizo una máquina de estados para controlar las vistas, de ahí el states.Enter(stViewStudy);, que lo que hace básicamente es llamar al procedimiento frExit, donde hago el free de studyList, y modificar algunos aspectos visuales.

El tema está en que si añado un frame TfrStudy (AddStudy(study)) y lo añado a la lista studyList:TobjectList, al cambiar de frame (eliminando por tanto la lista studyList), me salta un error EOSError System Error code 5. Si
no creo ningún frame y por tanto no elimino, no hay problemas.

Alguna idea ??

Gracias
Responder Con Cita
 



Normas de Publicación
no Puedes crear nuevos temas
no Puedes responder a temas
no Puedes adjuntar archivos
no Puedes editar tus mensajes

El código vB está habilitado
Las caritas están habilitado
Código [IMG] está habilitado
Código HTML está deshabilitado
Saltar a Foro

Temas Similares
Tema Autor Foro Respuestas Último mensaje
Borrar los Datasource Creados en tiempo de ejecucion Nieto OOP 2 29-11-2007 22:12:19
cambiar tamaño y mover componentes creados en tiempo de ejecucion gulder API de Windows 4 18-11-2006 23:21:16
Destruir Qrlabels creados en tiempo de ejecucion Ade Impresión 6 08-10-2006 19:46:28
Eventos en componentes creados en tiempo de ejecucion joumont OOP 3 27-12-2005 14:48:23
Objetos creados en tiempo de ejecución Scocc OOP 4 13-06-2003 20:55:29


La franja horaria es GMT +2. Ahora son las 15:06:59.


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