PDA

Ver la Versión Completa : TLabel not found


ioco
19-02-2010, 15:46:45
Buenas! Tengo una duda que me está dejando bastante paranoico porque no entiendo porqué me da el error este...

La cuestión es que desde un botón de un form, abro otro form.

Así en vacío, se abre bien... pero al añadirle una serie de TLabeledEdit y un par de TLabel (todo directo, sin modificar ninguna propiedad a nada) cuando le doy al botón me salta el error "TLabel not found" y no entiendo porqué ya que se supone que la clase está declarada en la unit StdCtrls (si he entendido bien lo que he leído por ahí).

En varios sitios he visto que hacen referencia a solucionarlo con Registerclass, pero siguen sin dejar claro ni el cómo ni el porqué (o más bien yo no lo entiendo).

¿Podríais orientarme un poco? :S

El formulario al que llamo es:
unit formporconcepto;

{$mode objfpc}{$H+}

interface

uses
Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs,
ExtCtrls, StdCtrls;

type

{ TForm2 }

TForm2 = class(TForm)
Label1: TLabel;
Label2: TLabel;
LabeledEdit1: TLabeledEdit;
LabeledEdit10: TLabeledEdit;
LabeledEdit11: TLabeledEdit;
LabeledEdit12: TLabeledEdit;
LabeledEdit13: TLabeledEdit;
LabeledEdit14: TLabeledEdit;
LabeledEdit15: TLabeledEdit;
LabeledEdit16: TLabeledEdit;
LabeledEdit17: TLabeledEdit;
LabeledEdit18: TLabeledEdit;
LabeledEdit19: TLabeledEdit;
LabeledEdit2: TLabeledEdit;
LabeledEdit20: TLabeledEdit;
LabeledEdit21: TLabeledEdit;
LabeledEdit3: TLabeledEdit;
LabeledEdit4: TLabeledEdit;
LabeledEdit5: TLabeledEdit;
LabeledEdit6: TLabeledEdit;
LabeledEdit7: TLabeledEdit;
LabeledEdit8: TLabeledEdit;
LabeledEdit9: TLabeledEdit;
private
{ private declarations }
public
{ public declarations }
end;

var
FormConcepto: TForm2;

implementation

initialization
{$I unit1.lrs}

end.



y lo arranco así desde el botón:
Application.CreateForm(TForm2, FormConcepto);
FormConcepto.Left := FormConcepto.Left + 10;
FormConcepto.Top := FormConcepto.Top + 10;
FormConcepto.Show;

BrunoBsso
23-02-2010, 23:47:07
No se si será la solución, pero probá en vez de:

Application.CreateForm(TForm2, FormConcepto);
FormConcepto.Left := FormConcepto.Left + 10;
FormConcepto.Top := FormConcepto.Top + 10;
FormConcepto.Show;


Pone:

TForm2.Create(Application); // o FormConcepto.Create(Application); no me acuerdo cual es
FormConcepto.Left := FormConcepto.Left + 10;
FormConcepto.Top := FormConcepto.Top + 10;
FormConcepto.Show;