unit guest;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ComCtrls, ExtCtrls, StdCtrls, ActnList, Grids, DBGrids, DB,
DBTables, Mask, DBCtrls;
type
Tfmcustinfo = class(TForm)
pnltitle: TPanel;
Panel2: TPanel;
Panel1: TPanel;
pnlcustinfo: TPanel;
sbhelp: TStatusBar;
tblcust: TTable;
dscust: TDataSource;
DBGrid1: TDBGrid;
tableaction: TActionList;
icustno: TLabel;
icustname: TLabel;
iaddress: TLabel;
itel: TLabel;
navcustinfo: TDBNavigator;
dbecustno: TDBEdit;
dbecustname: TDBEdit;
dbeaddress: TDBEdit;
dbetel: TDBEdit;
btninsert: TButton;
btnedit: TButton;
btnpost: TButton;
btndelete: TButton;
btncancel: TButton;
btnclose: TButton;
actinsert: TAction;
actedit: TAction;
actpost: TAction;
actdelete: TAction;
actcancel: TAction;
actclose: TAction;
procedure FormCreate(Sender: TObject);
procedure actinsertExecute(Sender: TObject);
procedure acteditExecute(Sender: TObject);
procedure actpostExecute(Sender: TObject);
procedure actdeleteExecute(Sender: TObject);
procedure actcancelExecute(Sender: TObject);
procedure actcloseExecute(Sender: TObject);
private
{ Private declarations }
procedure buttoncontrol(ntag:integer; bflag:boolean);
procedure myhint(sender:tobject);
procedure editcontrol(bflag:boolean);
public
{ Public declarations }
end;
var
fmcustinfo: Tfmcustinfo;
implementation
{$R *.dfm}
begin
procedure Tfmcustinfo.FormCreate(Sender: TObject);
begin
if not tblcust.active then begin
buttoncontrol(1,false);
buttoncontorl(2,false);
end
else begin
buttoncontrol(1,true);
buttoncontrol(2,false);
end;
application.onhint:=myhint;
end;
procedure tfmcustinfo.buttoncontrol(ntag:bflag; boolean);
var
nindex : integer;
begin
for nindex :=0 to componentcount-1 do
if components[nindex] is tbutton then
if tbutton(components[nindex]).tag=ntag then
tbutton(components[nindex]).enabled:=bflag;
end;
procedure tfmcustinfo.myhint(sender:tobject);
begin
sbhelp.simpletext:=application.hint
end;
procedure Tfmcustinfo.actinsertExecute(Sender: TObject);
begin
try
tblcust.insert;
buttoncontrol(1,false);
buttoncontrol(2,true);
buttoncontrol(true);
except
showmessage('테이블을 입력 모드로 전환하는 도중'+#13#10+
'에러가 발생했습니다.'+#13#10+
'확인 후 다시 시도해 주십시요.');
end;
end;
procedure tfmcustinfo.editcontrol(bflag:boolean);
var
nindex:integer
begin
for nindex :=0 to componentcount-1 do
if components[nindex]) is tdbedit then
tdbedit(components[nindex]).enabled:=bflag
end;
procedure Tfmcustinfo.acteditExecute(Sender: TObject);
begin
try
tblcust.edit;
buttoncontrol(1,false);
buttoncontrol(2,true);
buttoncontrol(true);
except
showmessage('테이블을 수정 모드로 전환하는 도중'+#13#10+
'에러가 발생했습니다.'+#13#10+
'확인 후 다시 시도해 주십시오.');
end;
end;
procedure Tfmcustinfo.actpostExecute(Sender: TObject);
var
savecursor:tcursor;
begin
if (tblcust.state=dsinsert) or (tblcust.state = dsedit) then begin
try
savecursor:=screen.cursor;
screen.cursor:=crhourglass;
tblcust.post;
buttoncontrol(1,true);
btttoncontrol(2,false);
editcontrol(false);
screen.cursor:=savecursor;
except
showmessage('테이블을 저장하는 도중 에러가 발생했습니다.'+#13#10+
'확인 후 다시 시도해 주십시오.');
end;
end;
end;
procedure Tfmcustinfo.actdeleteExecute(Sender: TObject);
begin
try
tblcust.delete;
except
showmessage('테이블을 삭제하는 도중 에러가 발생했습니다.'+#13#10+
'확인 후 다시 시도해 주십시오.');
end;
end;
procedure Tfmcustinfo.actcancelExecute(Sender: TObject);
begin
tblcust.cancel;
buttoncontrol(1,true);
buttoncontrol(2,false);
editcontrol(false);
end;
procedure Tfmcustinfo.actcloseExecute(Sender: TObject);
begin
close;
end;
end.
이런 코드를 완성했습니다..
실행을 해보려 하니 다음과 같은 에러가 뜹니다.....ㅠ
[Error] guest.pas(68): Statement expected but 'PROCEDURE' found
[Error] guest.pas(72): Undeclared identifier: 'buttoncontorl'
[Error] guest.pas(82): Undeclared identifier: 'bflag'
[Error] guest.pas(82): Missing parameter type
[Error] guest.pas(86): Undeclared identifier: 'componentcount'
[Error] guest.pas(87): Undeclared identifier: 'components'
[Error] guest.pas(87): Operator not applicable to this operand type
[Error] guest.pas(104): Incompatible types: 'Integer' and 'Boolean'
[Error] guest.pas(115): ';' expected but 'BEGIN' found
[Error] guest.pas(117): Type of expression must be BOOLEAN
[Error] guest.pas(130): Incompatible types: 'Integer' and 'Boolean'
[Error] guest.pas(138): Statement expected but 'PROCEDURE' found
[Error] guest.pas(148): Undeclared identifier: 'btttoncontrol'
[Error] guest.pas(44): Unsatisfied forward or external declaration: 'Tfmcustinfo.acteditExecute'
[Fatal Error] guestguest.dpr(5): Could not compile used unit 'guest.pas'
정말 초보라 옆에 물어볼 사람도 없고...... 정말 막막합니다..
책보고 따라하는 건데 이런 기초적인 것도 안되고.. 도와주세요!
그 에러코드를 더블 클릭하면 알아서 어디서 났는지 찾아줍니다.
아마 이전줄이나 다음줄 안에 에러가 있을겁니다.