Hola compañeros tengo un componente para mostrar varios display pongo el principio del código
Código Delphi
[-]unit MultiDisplay;
interface
uses
SysUtils, Classes, Controls, ExtCtrls, Graphics,UDiGDisplayJL2;
type
TDisplay1 =class(TPersistent) private
FDigits: byte;
FValue: string;
FBckgndColor, FDigitOnColor, FDigitOffColor: TColor;
FAlignment: TAlignment;
FLeadingZeros: boolean;
FTipoVisor : TTypeVisor;
procedure setTipoVisor(const Value:TTypeVisor);
procedure SetDigits(Value: byte);
procedure SetValue(Value: String);
procedure SetBckgndColor(Value: TColor);
procedure SetDigitOnColor(Value: TColor);
procedure SetDigitOffColor(Value: TColor);
procedure SetAlignment(Value: TAlignment);
procedure SetLeadingZeros(Value: boolean);
published
property LeadingZeros : boolean read FLeadingZeros write SetLeadingZeros default False;
property Alignment : TAlignment read FAlignment write SetAlignment default taRightjustify;
property Digits : byte read FDigits write SetDigits default 4;
property Value : string read FValue write SetValue;
property BckgndColor : TColor read FBckgndColor write SetBckgndColor;
property DigitOnColor : TColor read FDigitOnColor write SetDigitOnColor;
property DigitOffColor : TColor read FDigitOffColor write SetDigitOffColor;
property TipoVisor : TTypeVisor read FTipoVisor write SetTipoVisor default VNumeric;
end;
type
TDisplay2 =class(TPersistent) private
FDigits: byte;
FValue: string;
FBckgndColor, FDigitOnColor, FDigitOffColor: TColor;
FAlignment: TAlignment;
FLeadingZeros: boolean;
FTipoVisor : TTypeVisor;
procedure setTipoVisor(const Value:TTypeVisor);
procedure SetDigits(Value: byte);
procedure SetValue(Value: String);
procedure SetBckgndColor(Value: TColor);
procedure SetDigitOnColor(Value: TColor);
procedure SetDigitOffColor(Value: TColor);
procedure SetAlignment(Value: TAlignment);
procedure SetLeadingZeros(Value: boolean);
published
property LeadingZeros : boolean read FLeadingZeros write SetLeadingZeros default False;
property Alignment : TAlignment read FAlignment write SetAlignment default taRightjustify;
property Digits : byte read FDigits write SetDigits default 4;
property Value : string read FValue write SetValue;
property BckgndColor : TColor read FBckgndColor write SetBckgndColor;
property DigitOnColor : TColor read FDigitOnColor write SetDigitOnColor;
property DigitOffColor : TColor read FDigitOffColor write SetDigitOffColor;
property TipoVisor : TTypeVisor read FTipoVisor write SetTipoVisor default VNumeric;
end;
type
TDisplay3 =class(TPersistent) private
FDigits: byte;
FValue: string;
FBckgndColor, FDigitOnColor, FDigitOffColor: TColor;
FAlignment: TAlignment;
FLeadingZeros: boolean;
FTipoVisor : TTypeVisor;
procedure setTipoVisor(const Value:TTypeVisor);
procedure SetDigits(Value: byte);
procedure SetValue(Value: String);
procedure SetBckgndColor(Value: TColor);
procedure SetDigitOnColor(Value: TColor);
procedure SetDigitOffColor(Value: TColor);
procedure SetAlignment(Value: TAlignment);
procedure SetLeadingZeros(Value: boolean);
published
property LeadingZeros : boolean read FLeadingZeros write SetLeadingZeros default False;
property Alignment : TAlignment read FAlignment write SetAlignment default taRightjustify;
property Digits : byte read FDigits write SetDigits default 4;
property Value : string read FValue write SetValue;
property BckgndColor : TColor read FBckgndColor write SetBckgndColor;
property DigitOnColor : TColor read FDigitOnColor write SetDigitOnColor;
property DigitOffColor : TColor read FDigitOffColor write SetDigitOffColor;
property TipoVisor : TTypeVisor read FTipoVisor write SetTipoVisor default VNumeric;
end;
type
TComunes =class(TPersistent) private
FComun: Boolean; FDigits: byte;
FBckgndColor, FDigitOnColor, FDigitOffColor: TColor;
FAlignment: TAlignment;
FLeadingZeros: boolean;
FTipoVisor : TTypeVisor;
procedure SetComun(value:Boolean);
procedure setTipoVisor(const Value:TTypeVisor);
procedure SetDigits(Value: byte);
procedure SetBckgndColor(Value: TColor);
procedure SetDigitOnColor(Value: TColor);
procedure SetDigitOffColor(Value: TColor);
procedure SetAlignment(Value: TAlignment);
procedure SetLeadingZeros(Value: boolean);
published
property Comun : Boolean read FComun write SetComun default False;
property LeadingZeros : boolean read FLeadingZeros write SetLeadingZeros default False;
property Alignment : TAlignment read FAlignment write SetAlignment default taRightjustify;
property Digits : byte read FDigits write SetDigits default 4;
property BckgndColor : TColor read FBckgndColor write SetBckgndColor;
property DigitOnColor : TColor read FDigitOnColor write SetDigitOnColor;
property DigitOffColor : TColor read FDigitOffColor write SetDigitOffColor;
property TipoVisor : TTypeVisor read FTipoVisor write SetTipoVisor default VNumeric;
end;
type
TEspacio = 0..5;
TNumbers = 1..3;
TMultiDisplay = class(TPanel)
private
FDisplay1 :TDisplay1;
FDisplay2 :TDisplay2;
FDisplay3 :TDisplay3;
FComunes :TComunes;
FSpace :TEspacio;
FNumbersDisplays :TNumbers;
FDisp1 :TDigitDisplayJL_R; FDisp2 :TDigitDisplayJL_R;
FDisp3 :TDigitDisplayJL_R;
procedure SetSpace(Value:TEspacio);
procedure SetNumbersDisplays(Value:TNumbers);
protected
procedure Paint; override;
procedure Resize; override;
public
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
procedure clear;
published
property Space :TEspacio read FSpace Write SetSpace;
property NumbersDisplays :TNumbers read FNumbersDisplays write SetNumbersDisplays;
property Display1 :TDisplay1 read FDisplay1 write FDisplay1;
property Display2 :TDisplay2 read FDisplay2 write FDisplay2;
property Display3 :TDisplay3 read FDisplay3 write FDisplay3;
property Comunes :TComunes read FComunes write FComunes;
end;
hasta aquí todo bien, el problema surge cuando quiero acceder a un cambio desde por Ejemplo Tdisplay1.value a Disp1.value, investigando en internet he visto en otros componetes que declaran la clase del componente antes de su uso (de que realmente se cree) de la siguiente forma, seria por ejemplo en el TDisplay1
y luego dentro de mi Tdiplay1 iría las siguientes lineas de código
Código Delphi
[-]uses
SysUtils, Classes, Controls, ExtCtrls, Graphics,UDiGDisplayJL2;
TMultiDisplay = class;
type
TDisplay1 =class(TPersistent) private
FDigits: byte;
FMulti :TMultiDisplay;
FValue: string;
FBckgndColor, FDigitOnColor, FDigitOffColor: TColor;
FAlignment: TAlignment;
FLeadingZeros: boolean;
FTipoVisor : TTypeVisor;
procedure setTipoVisor(const Value:TTypeVisor);
procedure SetDigits(Value: byte);
procedure SetValue(Value: String);
procedure SetBckgndColor(Value: TColor);
procedure SetDigitOnColor(Value: TColor);
procedure SetDigitOffColor(Value: TColor);
procedure SetAlignment(Value: TAlignment);
procedure SetLeadingZeros(Value: boolean);
procedure SetMulti(value:TMultiDisplay);
published
property LeadingZeros : boolean read FLeadingZeros write SetLeadingZeros default False;
property Alignment : TAlignment read FAlignment write SetAlignment default taRightjustify;
property Digits : byte read FDigits write SetDigits default 4;
property Value : string read FValue write SetValue;
property BckgndColor : TColor read FBckgndColor write SetBckgndColor;
property DigitOnColor : TColor read FDigitOnColor write SetDigitOnColor;
property DigitOffColor : TColor read FDigitOffColor write SetDigitOffColor;
property TipoVisor : TTypeVisor read FTipoVisor write SetTipoVisor default VNumeric;
property Multi: TMultiDisplay read FMulti write SetMulti;
end;
Pero me da los siguientes errores
Cita:
[DCC Error] MultiDisplay.pas(10): E2086 Type 'TMultiDisplay' is not yet completely defined
[DCC Error] MultiDisplay.pas(131): E2004 Identifier redeclared: 'TMultiDisplay'
[DCC Error] MultiDisplay.pas(28): E2005 'TMultiDisplay' is not a type identifier
|
Si me podéis explicar que estoy haciendo mal y cual sería la forma correcta, me ayudaríais mucho.
Como siempre gracias