Onde está o erro desse código ???

22/02/2003

0

Amigos do Forum

Me ajudem a descobrir o que há de errado, não consigo compilar
mensagem de erro:[Error] abre.pas(53): Type ´registro´ needs finalization - not allowed in file type

unit abre;

interface

uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, shellapi,StdCtrls, ComCtrls, ExtCtrls, Mask;

type
TForm1 = class(TForm)
Button1: TButton;
MonthCalendar1: TMonthCalendar;
Label1: TLabel;
Edit1: TEdit;
Button2: TButton;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
Nome1: TLabel;
Nome2: TLabel;
Nome3: TLabel;
Nome4: TLabel;
MaskEdit1: TMaskEdit;
Button3: TButton;
Bevel1: TBevel;
Splitter1: TSplitter;
Label5: TLabel;
procedure Button2Click(Sender: TObject);
procedure MonthCalendar1Click(Sender: TObject);
procedure Label1Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
procedure Label3Click(Sender: TObject);
procedure Label4Click(Sender: TObject);
procedure Label2Click(Sender: TObject);
{ Private declarations }
public
{ Public declarations }
end;

const
ag = ´agenda.dat´;

type
registro = record
dia_con:tdatetime;
nome_pac:array[1..4]of string;
tel_pac: array[1..4]of string;
end;

var
Form1: TForm1;
reg_ag: registro;
arquivo: file of registro; [color=red:19a5c80077][size=18:19a5c80077]{dá erro aqui..????}[/size:19a5c80077][/color:19a5c80077]
agenda: arquivo;
aponta:integer;

implementation

{$R *.dfm}


procedure TForm1.Button2Click(Sender: TObject);

var
dia:tdatetime;
begin
dia:= strtodate(´21/01/2002´);
label1.Caption:= datetostr(dia);
monthcalendar1.date:=now+21;
edit1.Text:=datetostr(monthcalendar1.date);
end;

procedure TForm1.Label1Click(Sender: TObject);
begin
aponta:=1;
edit1.text:=´´;
edit1.SetFocus;
end;

procedure TForm1.Label2Click(Sender: TObject);
begin
aponta:=2;
edit1.text:=´´;
edit1.SetFocus;
end;

procedure TForm1.Label3Click(Sender: TObject);
begin
aponta:=3;
edit1.text:=´´;
edit1.SetFocus;
end;

procedure TForm1.Label4Click(Sender: TObject);
begin
aponta:=4;
edit1.text:=´´;
edit1.SetFocus;
end;

procedure TForm1.Button3Click(Sender: TObject);
begin
if aponta = 1 then
begin
nome1.Caption:=edit1.text;
reg_ag.nome_pac[1]:=edit1.text;
end;

if aponta = 2 then
begin
nome2.Caption:=edit1.text;
reg_ag.nome_pac[2]:=nome2.caption;
end;

if aponta = 3 then
begin
nome3.caption:=edit1.text;
reg_ag.nome_pac[3]:=nome3.caption;
end;

if aponta = 4 then
begin
nome4.Caption:=edit1.text;
reg_ag.nome_pac[4]:=nome4.caption;

end;

reg_ag.dia_con:=monthcalendar1.Date;

end;

procedure TForm1.MonthCalendar1Click(Sender: TObject);
begin
shortdateformat:=´dd/mm/yyyy´;
maskedit1.text:=datetostr(monthcalendar1.date);
shortdateformat:=´ddd/mmmm/yyyyy´;
label5.Caption:= datetostr(monthcalendar1.date);

if reg_ag.dia_con =monthcalendar1.date then
begin
nome1.caption:=reg_ag.nome_pac[1];
nome2.caption:=reg_ag.nome_pac[2];
nome3.caption:=reg_ag.nome_pac[3];
nome4.Caption:=reg_ag.nome_pac[4];
end

else
begin
nome1.Caption:=´´;
nome2.Caption:=´´;
nome3.Caption:=´´;
nome4.caption:=´´;
end;

end;

end.


brigadu :D


Lobo Astuto

Lobo Astuto

Responder

Posts

22/02/2003

Anonymous

O tipo string não pode ser aplicado a registros definido pelo usuário. É um tipo de dado muito complexo para ser manipulado, quando se referencia a um arquivo. Substitua por char. Se vc alterar para:

type
Tregistro = record
dia_con:tdatetime;
nome_pac:array[1..4]of char;
tel_pac: array[1..4]of char;
end;

Vai dar certo !

Valeu?


Responder

Assista grátis a nossa aula inaugural

Assitir aula

Saiba por que programar é uma questão de
sobrevivência e como aprender sem riscos

Assistir agora

Utilizamos cookies para fornecer uma melhor experiência para nossos usuários, consulte nossa política de privacidade.

Aceitar