Club Delphi  
    Paypal   FTP   CCD     Buscar   Trucos   Trabajo   Foros

Go Back   Foros Club Delphi > Principal > OOP
Register FAQ Members List Calendar Guía de estilo Search Today's Posts Mark Forums Read

Coloboración Paypal con ClubDelphi

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 02/03/2008
TeAOrco TeAOrco is offline
Registrado
 
Join Date: Oct 2006
Posts: 5
Poder: 0
TeAOrco Va por buen camino
Unhappy Frames en un paquete

Hola estoy intentando en la aplicación principal mostrar los frames que estan almacenados en un paquete (que cargo de forma dinamica):


Código Delphi [-]
var
Modulo: HModule;
ClaseFrame: TCustomFrameClass;
FrameC: TFrame;
begin
Modulo:=LoadPackage('FramePru.bpl');
if Modulo<>0 then
begin
ClaseFrame:=TCustomFrameClass(GetClass('TfraVerde'));
if ClaseFrame<>Nil then
begin
FrameC:=TFrame(ClaseFrame.Create(Application));
FrameC.Parent:=Self;
FrameC.Align:=alBottom;
FrameC.Height:=200;
FrameC.Visible:=True;
end;
end;





Pero al ejecutarlo me da el siguiente error:

Project Prueba.exe raised exception class EConverErro with message 'Cannot assign a TFont to a TFont'.


El error lo da al asignar Código Delphi [-]FrameC.Parent:=Self;




Si modifico la sentencia Código Delphi [-]FrameC:=TFrame(ClaseFrame.Create(Application));

por Código Delphi [-]FrameC:=TFrame(ClaseFrame).Create(Application);

me da un error de Access violation at address...

Algun tipo de sugerencia, muchas gracias.
Reply With Quote
  #2  
Old 02/03/2008
Lepe's Avatar
[Lepe] Lepe is offline
Miembro Premium
 
Join Date: May 2003
Posts: 7,424
Poder: 31
Lepe Va por buen camino
FrameC:=TFrame(ClaseFrame).Create(Self);

Por lógica, yo pondría el dueño y el padre al mismo control, en este caso el propio Form donde se creará el frame.

Saludos
__________________
Si usted entendió mi comentario, contácteme y gustosamente,
se lo volveré a explicar hasta que no lo entienda, Gracias.
Reply With Quote
  #3  
Old 02/03/2008
Caral's Avatar
[Caral] Caral is offline
Miembro Premium
 
Join Date: Aug 2006
Posts: 7,659
Poder: 28
Caral Va por buen camino
Hola
Lepe aprovecho para aprender.
Aqui veo algo extraño:
El parent no deberia ser el form?., es asi o me equivoco.?
Código Delphi [-]
FrameC:=TFrame(ClaseFrame).Create(Self);
FrameC.Parent:=Self; // esta linea, no debería de ser el Form?
Saludos
Reply With Quote
  #4  
Old 02/03/2008
TeAOrco TeAOrco is offline
Registrado
 
Join Date: Oct 2006
Posts: 5
Poder: 0
TeAOrco Va por buen camino
Modificado:
Código Delphi [-]
 
 
var
  Modulo: HModule;
  ClaseFrame: TCustomFrameClass;
  FrameC: TFrame;
begin
  Modulo:=LoadPackage('FramePru.bpl');
  if Modulo<>0 then
    begin
    ClaseFrame:=TCustomFrameClass(GetClass('TfraVerde'));
    if ClaseFrame<>Nil then
      begin
      FrameC:=TFrame(ClaseFrame.Create(Self));
      FrameC.Parent:=Self;
      FrameC.Align:=alBottom;
      FrameC.Height:=200;
      FrameC.Visible:=True;
      end;
    end;

Mismo error en la misma linea.
Reply With Quote
  #5  
Old 02/03/2008
Caral's Avatar
[Caral] Caral is offline
Miembro Premium
 
Join Date: Aug 2006
Posts: 7,659
Poder: 28
Caral Va por buen camino
Hola
Yo de esto no se, el maestro es Lepe, pero me parece que deberia de ser el parente el form en el que se hospeda.
Código Delphi [-]
var
  Modulo: HModule;
  ClaseFrame: TCustomFrameClass;
  FrameC: TFrame;
begin
  Modulo:=LoadPackage('FramePru.bpl');
  if Modulo<>0 then
    begin
    ClaseFrame:=TCustomFrameClass(GetClass('TfraVerde'));
    if ClaseFrame<>Nil then
      begin
      FrameC:=TFrame(ClaseFrame).Create(Form1); // el form donde se crea
      FrameC.Parent:=Form1; // el form donde vive
      FrameC.Align:=alBottom;
      FrameC.Height:=200;
      FrameC.Visible:=True;
      end;
    end;
Saludos
Reply With Quote
  #6  
Old 02/03/2008
TeAOrco TeAOrco is offline
Registrado
 
Join Date: Oct 2006
Posts: 5
Poder: 0
TeAOrco Va por buen camino
En este caso Self y Form1 son el mismo, ya que este codigo se ejecuta desde el Form1.
Reply With Quote
  #7  
Old 02/03/2008
Caral's Avatar
[Caral] Caral is offline
Miembro Premium
 
Join Date: Aug 2006
Posts: 7,659
Poder: 28
Caral Va por buen camino
Hola
Muy cierto, lo he probado de la dos formas y funciona, algo mas que aprendi.
Saludos
Reply With Quote
  #8  
Old 06/03/2008
TeAOrco TeAOrco is offline
Registrado
 
Join Date: Oct 2006
Posts: 5
Poder: 0
TeAOrco Va por buen camino
De esta forma si tira:

Código Delphi [-]
 
Var
  Modulo: HMODULE;
  AClass: TPersistentClass;
begin
  Modulo:=LoadPackage('Segundo.bpl');
  if Modulo<>0 then
    begin
    AClass:=GetClass('TfrmSegundo');
    if AClass<>nil then
      begin
      if Assigned(FrameC) then
        FrameC.Free;
      FrameC:=TFrame(TComponentClass(AClass).Create(Self));
      FrameC.Parent:=Self;
      FrameC.Align:=alClient;
      FrameC.Visible:=True;
      end;
    end;
end;

FrameC esta declarado en la parte publica del formulario como TFrame.
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Recuperar paquete DTS!!! drykea SQL 0 02/10/2007 15:55
Paquete Graphics32 dicatek Gráficos 4 13/06/2006 14:27
Paquete Qreport soloriv Varios 2 05/06/2006 16:38
paquete wpt_d7 NuncaMas Impresión 0 18/11/2004 14:39
Llamar a un paquete DTS Zopi Conexión con bases de datos 0 09/09/2004 23:37


All times are GMT +2. The time now is 11:36.


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
Copyright 1996-2007 Club Delphi