1
I have a calendar only with month/year and created an "event" so that, when it was selected, the month could be treated and the fields filled.
type
TonAnoMesSelecionadoEvent = procedure(Sender,Parent:TObject;Mes,Ano:Integer);
TCalendario = class(TwinControl)
....
Procedure pnlMesClick(Sender:tobject);
private
FMes,FAno:Word;
protected
//FonAnoMesSelecionado :TonAnoMesSelecionadoEvent;
public
FonAnoMesSelecionado:TonAnoMesSelecionadoEvent;{tem a propriet mas removi ela pois achei que o erro era esse}
constructor Create(AOnwer: TComponent); overload; override;
constructor Create(AOnwer: TComponent;X,Y:integer);overload;
constructor Create(AOnwer: TComponent;X,Y,ano:integer);overload;
procedure pShowCalendar(AOnwer: TComponent;X,Y:integer);
end;
.....
procedure TfrmCalendario.pnlMesClick(Sender: TObject);
begin
if Assigned(FonAnoMesSelecionado) then
FonAnoMesSelecionado(Self,Owner,TPanel(Sender).Tag,btnAnos.Tag);
end;
The problem occurs when trying to associate my Procedure eastward Field
:
Tform1 = Class(Tform)
....
procedure FormClick(Sender: TObject);
procedure onSelect(Sender,Parent:TObject;Mes,Ano:Integer) ;
end;
Procedure tform1.btnClick(sender:tObject);
var
lCalendar:TCalendario;
begin
lCalendar:TCalendario.Create(self);
lCalendar.FonAnoMesSelecionado := OnSelect;//<- erro ocorre nessa linha
//lCalendar.pShowCalendar(.....);
//......
end
procedure tform1.onSelect(Sender, Parent: TObject; Mes, Ano: Integer);
begin
ShowMessage(IntToStr(Mes)+'/'+IntToStr(Ano));
end;
I don’t know how I can do this, what’s wrong???
Bah! had forgotten the
Of object
. Thanks!!!!– HagaHood