Ver Mensaje Individual
  #1  
Antiguo 14-09-2007
mauqu mauqu is offline
Miembro
 
Registrado: may 2007
Posts: 28
Reputación: 0
mauqu Va por buen camino
error al colocar un componente propio a un form

Estimados, estoy tratando de programar un componente propio y el código resultante es este.

//Inicio

type
TProducto = class(TPanel)
protected
procedure SetHeight(Value:integer);
procedure SetWidth(Value:integer);
procedure SetForma(Value:TShapeType);
procedure SetEtiqueta(Value:String);
procedure SetColorForma(Value:TColor);
procedure SetOnMouseDown(Value:TMouseEvent);

function GetForma:TShapeType;
function GetHeight:integer;
function GetWidth:integer;
function GetEtiqueta:string;
function GetColorForma:TColor;
function GetOnMouseDown:TMouseEvent;

published
sForma:TShape;
lEtiqueta:TLabel;

constructor PanelCreate(Sender: Tcomponent);
procedure PanelMouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
procedure ShapeMouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
property Height:integer read GetHeight write SetHeight default 0;
property Width:integer read GetWidth write SetWidth default 0;
property Forma:TShapeType read GetForma write SetForma default stRoundRect;
property Etiqueta:string read GetEtiqueta write SetEtiqueta;
property ColorForma:TColor read GetColorForma write SetColorForma default clGreen;
property OnMouseDown:TMouseEvent read GetOnMouseDown write SetOnMouseDown;
//property PopUpMenu:TPopUpMenu read GetPopUpMenu write SetPopUpMenu;

public
procedure MostrarMensaje; virtual; abstract;
private

end;
//Fin

Obviamente despues de implementation esta el código necesario para todos los procesos y funciones declarados para la clase, no lo escribo acá por que ya es mucho :S.

El tema es que cuando registro esta clase y la instalo como un nuevo componente, aparece el la barra de componentes todo muy lindo, pero cuando la ubico en un form me sale un error "Acces violation in module productos.bpl" y luego "stack overflow save your work and restart delphi" cuac :SSS.

por que se puede dar esto.

sludos.
Responder Con Cita