home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
DP Tool Club 19
/
CD_ASCQ_19_010295.iso
/
dos
/
prg
/
pas
/
ktools
/
source
/
calend.pas
< prev
next >
Wrap
Pascal/Delphi Source File
|
1994-11-12
|
3KB
|
133 lines
Program Calend;
{ calendrier }
{ K.B. 1994 }
{.$DEFINE debug}
{$IFDEF debug}
{$A+,B-,D+,E-,F-,I+,L+,N-,R+,S+,V-,W+,X+}
{$ELSE}
{$A+,B-,D-,E-,F-,I+,L-,N-,R-,S-,V-,W+,X+}
{$ENDIF}
Uses Dos,UMem,UDrivers,OTableau,
OGenView,OTxtView,OCalend,ODialWin,OHelpWin;
Const
erInit = 100;
Type
TCalendApp=object(TTextApp)
Constructor Init;
Procedure InitStatusLine;virtual;
Procedure HandleEvent(Var Event:TEvent);virtual;
End;
Constructor TCalendApp.Init;
Var W : PCalendWin;
Begin
TTextApp.Init;
Titre:='CALENDRIER (K.B. novembre 1994)';
W:=New(PCalendWin,Init);
if W^.IsValid
then begin
Insert(W);
W^.Select;
end
else begin
ErrorFlag:=erInit;
SetCommand(cmQuit);
end;
End;
Procedure TCalendApp.InitStatusLine;
Begin
TTextApp.InitStatusLine;
with StatusLine^ do
begin
AjouterItem('F1 Aide',F1);
AjouterItem('AltX Quitter',AltX);
AjouterItem('? A Propos',ord('?'));
end;
End;
Procedure TCalendApp.HandleEvent(Var Event:TEvent);
Var W:PCalendWin;
H:PHelpWin;
Begin
if (Event.What=evCommand) and (Event.Command=cmClose)
then Event.What:=evNothing;
if (Event.What=evCommand) and (Event.Command=cmQuit)
and not IsValid
then Message('Erreur d''initialisation du calendrier.');
TTextApp.HandleEvent(Event);
case Event.What of
evKeyDown:
case Event.KeyCode of
F1:
begin
H:=new(PHelpWin,Init(AppPath+'calend.hlp'));
if H^.IsValid
then begin
Insert(H);
H^.Exec;
dispose(H,Done);
end
else begin
Message(H^.GetErrorMsg);
dispose(H,done);
end;
end;
ord('?'): Message(chr(13)+
' CALENDRIER 1.0 '+chr(13)+
' Kostrzewa Bruno (1994) '+chr(13));
else exit;
end;
else exit;
end;
Event.What:=evNothing;
End;
Procedure Alarme;
Var w1,w2,w3,w4 : Word;
Table : PStrTab;
S : String;
Begin
GetDate(w1,w2,w3,w4);
Table:=MakeCal(w1);
S:=Table^.Ligne(NumJour(w3,w2,w1));
writeln(TabJours[w4],' ',w3,' ',TabMois[w2],' ',w1);
if S<>''
then begin
writeln(S);
write(#7,#7,#7);
w4:=GetReadKey;
dispose(Table,Done);
end;
End;
Var MonApp:TCalendApp;
b:Byte;
Begin
{$ifdef debug}
initmem;
{$endif}
if ParamCount>0
then begin
if ParamStr(1)<>'/A'
then writeln('Utiliser le paramètre /A.');
Alarme;
halt(0);
end;
MonApp.Init;
b:=MonApp.Exec;
if b<>1
then writeln(MonApp.GetErrorMsg);
MonApp.Done;
{$ifdef debug}
diagmem;
{$endif}
End.
{ Fin du fichier Calend.Pas }