Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- PROGRAM YELLOWCROSSWORD;
- USES STRINGS,WINTYPES,WINPROCS,WOBJECTS,STDDLGS;
- {$R CRYPTIC.RES}
- {$R YELLOW.RES}
- {$R PIC.RES}
- CONST
- CM_ANSWERS=101;
- CM_ABOUTCRYPTIC=102;
- CM_INSTRUCTIONS=103;
- CM_OPEN=111;
- CM_SAVE=112;
- ID_NEXT=121;
- ID_PREVIOUS=122;
- MAXLENGTH=150;
- DOTITLE:BOOLEAN=TRUE;
- TYPE
- CROSSWORD=ARRAY[0..18] OF STRING;
- TMYAPP=OBJECT(TAPPLICATION)
- PROCEDURE INITMAINWINDOW; VIRTUAL;
- END;
- PMYDIALOG=^TMYDIALOG;
- TMYDIALOG=OBJECT(TDIALOG)
- CONSTRUCTOR INIT(APARENT:PWINDOWSOBJECT;ATITLE:PCHAR);
- END;
- PMYWINDOW=^TMYWINDOW;
- TMYWINDOW=OBJECT(TWINDOW)
- HIMAGE:HBITMAP;
- FILENAME:ARRAY[0..200] OF CHAR;
- DATAFILE:FILE OF CROSSWORD;
- MYPEN:HPEN;
- PENSIZE,PENSTYLE:INTEGER;
- PENCOLOR:TCOLORREF;
- XY:STRING;
- TEMP:STRING;
- TEMPWORD:ARRAY[0..19] OF CHAR;
- TEXTLEN,XPOS,YPOS,POSITION:BYTE;
- DC:HDC;
- DISPLAYANSWERS:BOOLEAN;
- QUESTION:ARRAY[0..MAXLENGTH] OF CHAR;
- CHARACTER:ARRAY[0..1] OF CHAR;
- SQUAREFILL,ANSWER:CROSSWORD;
- {..........................}
- PROCEDURE TMYWINDOW.WMLBUTTONDOWN(VAR MSG:TMESSAGE);
- VAR
- S1,S2:ARRAY[0..2] OF CHAR;
- MSGX,MSGY,COUNT,NUMBER,LENGTH:INTEGER;
- TEXT:ARRAY[0..19] OF CHAR;
- BEGIN
- MSGX:=(MSG.LPARAMLO-13)DIV 16;
- MSGY:=(MSG.LPARAMHI-13)DIV 17;
- STRPCOPY(S1,CHR((MSGX DIV 10)+48)+CHR(MSGX-(MSGX DIV 10)*10+48));
- STRPCOPY(S2,CHR((MSGY DIV 10)+48)+CHR(MSGY-(MSGY DIV 10)*10+48));
- XY:=S1[0]+S1[1]+','+S2[0]+S2[1];
- NUMBER:=0;
- FOR COUNT:=1 TO 53 DO
- IF AXY[COUNT]=XY THEN NUMBER:=COUNT;
- IF NUMBER<>0 THEN
- BEGIN
- COUNT:=MSGX+1;TEMP:='';LENGTH:=1;
- {.......}
- PROCEDURE TMYWINDOW.GETWINDOWCLASS(VAR AWNDCLASS:TWNDCLASS);
- BEGIN
- TWINDOW.GETWINDOWCLASS(AWNDCLASS);
- AWNDCLASS.HICON:=LOADICON(HINSTANCE,'ICON');
- AWNDCLASS.HCURSOR:=LOADCURSOR(HINSTANCE,'HAND');
- END;
- CONSTRUCTOR TMYWINDOW.INIT(APARENT:PWINDOWSOBJECT;ATITLE:PCHAR);
- VAR
- DLG:TMYDIALOG;
- REPLY:INTEGER;
- BEGIN
- DISPLAYANSWERS:=FALSE;
- TWINDOW.INIT(APARENT,ATITLE);
- ATTR.MENU:=LOADMENU(HINSTANCE,'CROSSWORDMENU');
- ATTR.X:=-4;
- ATTR.Y:=-4;
- ATTR.W:=650;
- ATTR.H:=488;
- HIMAGE:=LOADBITMAP(HINSTANCE,'TITLE');
- {.................................}
- FUNCTION TMYWINDOW.CANCLOSE:BOOLEAN;
- VAR
- REPLY:INTEGER;
- BEGIN
- CANCLOSE:=TRUE;
- REPLY:=MESSAGEBOX(HWINDOW,'Are you sure you want to quit?',
- 'Cryptic Crossword V1.0',
- MB_OKCANCEL+MB_ICONQUESTION);
- IF(REPLY=ID_CANCEL)THEN
- CANCLOSE:=FALSE;
- END;
- PROCEDURE TMYAPP.INITMAINWINDOW;
- BEGIN
- MAINWINDOW:=NEW(PMYWINDOW,INIT(NIL,'YELLOW Crossword'));
- END;
- VAR
- MYAPP:TMYAPP;
- BEGIN
- MYAPP.INIT('Cryptic Crossword');
- MYAPP.RUN;
- MYAPP.DONE;
- END.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement