Advertisement
paul_nicholls

Untitled

Jan 20th, 2024 (edited)
1,465
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pascal 2.87 KB | None | 0 0
  1. PROGRAM YELLOWCROSSWORD;
  2. USES STRINGS,WINTYPES,WINPROCS,WOBJECTS,STDDLGS;
  3. {$R CRYPTIC.RES}
  4. {$R YELLOW.RES}
  5. {$R PIC.RES}
  6. CONST
  7.    CM_ANSWERS=101;
  8.    CM_ABOUTCRYPTIC=102;
  9.    CM_INSTRUCTIONS=103;
  10.    CM_OPEN=111;
  11.    CM_SAVE=112;
  12.    ID_NEXT=121;
  13.    ID_PREVIOUS=122;
  14.    MAXLENGTH=150;
  15.    DOTITLE:BOOLEAN=TRUE;
  16. TYPE
  17.    CROSSWORD=ARRAY[0..18] OF STRING;
  18.    TMYAPP=OBJECT(TAPPLICATION)
  19.       PROCEDURE INITMAINWINDOW; VIRTUAL;
  20.    END;
  21.    PMYDIALOG=^TMYDIALOG;
  22.    TMYDIALOG=OBJECT(TDIALOG)
  23.       CONSTRUCTOR INIT(APARENT:PWINDOWSOBJECT;ATITLE:PCHAR);
  24.    END;
  25.    PMYWINDOW=^TMYWINDOW;
  26.    TMYWINDOW=OBJECT(TWINDOW)
  27.       HIMAGE:HBITMAP;
  28.       FILENAME:ARRAY[0..200] OF CHAR;
  29.       DATAFILE:FILE OF CROSSWORD;
  30.       MYPEN:HPEN;
  31.       PENSIZE,PENSTYLE:INTEGER;
  32.       PENCOLOR:TCOLORREF;
  33.       XY:STRING;
  34.       TEMP:STRING;
  35.       TEMPWORD:ARRAY[0..19] OF CHAR;
  36.       TEXTLEN,XPOS,YPOS,POSITION:BYTE;
  37.       DC:HDC;
  38.       DISPLAYANSWERS:BOOLEAN;
  39.       QUESTION:ARRAY[0..MAXLENGTH] OF CHAR;
  40.       CHARACTER:ARRAY[0..1] OF CHAR;
  41.       SQUAREFILL,ANSWER:CROSSWORD;
  42.  
  43. {..........................}
  44.  
  45.    PROCEDURE TMYWINDOW.WMLBUTTONDOWN(VAR MSG:TMESSAGE);
  46.    VAR
  47.       S1,S2:ARRAY[0..2] OF CHAR;
  48.       MSGX,MSGY,COUNT,NUMBER,LENGTH:INTEGER;
  49.       TEXT:ARRAY[0..19] OF CHAR;
  50.    BEGIN
  51.       MSGX:=(MSG.LPARAMLO-13)DIV 16;
  52.       MSGY:=(MSG.LPARAMHI-13)DIV 17;
  53.       STRPCOPY(S1,CHR((MSGX DIV 10)+48)+CHR(MSGX-(MSGX DIV 10)*10+48));
  54.       STRPCOPY(S2,CHR((MSGY DIV 10)+48)+CHR(MSGY-(MSGY DIV 10)*10+48));
  55.       XY:=S1[0]+S1[1]+','+S2[0]+S2[1];
  56.       NUMBER:=0;
  57.       FOR COUNT:=1 TO 53 DO
  58.          IF AXY[COUNT]=XY THEN NUMBER:=COUNT;
  59.       IF NUMBER<>0 THEN
  60.       BEGIN
  61.          COUNT:=MSGX+1;TEMP:='';LENGTH:=1;
  62.  
  63. {.......}
  64.    PROCEDURE TMYWINDOW.GETWINDOWCLASS(VAR AWNDCLASS:TWNDCLASS);
  65.    BEGIN
  66.       TWINDOW.GETWINDOWCLASS(AWNDCLASS);
  67.       AWNDCLASS.HICON:=LOADICON(HINSTANCE,'ICON');
  68.       AWNDCLASS.HCURSOR:=LOADCURSOR(HINSTANCE,'HAND');
  69.    END;
  70.    CONSTRUCTOR TMYWINDOW.INIT(APARENT:PWINDOWSOBJECT;ATITLE:PCHAR);
  71.    VAR
  72.       DLG:TMYDIALOG;
  73.       REPLY:INTEGER;
  74.    BEGIN
  75.       DISPLAYANSWERS:=FALSE;
  76.       TWINDOW.INIT(APARENT,ATITLE);
  77.       ATTR.MENU:=LOADMENU(HINSTANCE,'CROSSWORDMENU');
  78.       ATTR.X:=-4;
  79.       ATTR.Y:=-4;
  80.       ATTR.W:=650;
  81.       ATTR.H:=488;
  82.       HIMAGE:=LOADBITMAP(HINSTANCE,'TITLE');
  83. {.................................}
  84.    FUNCTION TMYWINDOW.CANCLOSE:BOOLEAN;
  85.    VAR
  86.       REPLY:INTEGER;
  87.    BEGIN
  88.       CANCLOSE:=TRUE;
  89.       REPLY:=MESSAGEBOX(HWINDOW,'Are you sure you want to quit?',
  90.       'Cryptic Crossword V1.0',
  91.       MB_OKCANCEL+MB_ICONQUESTION);
  92.       IF(REPLY=ID_CANCEL)THEN
  93.       CANCLOSE:=FALSE;
  94.    END;
  95.    PROCEDURE TMYAPP.INITMAINWINDOW;
  96.    BEGIN
  97.       MAINWINDOW:=NEW(PMYWINDOW,INIT(NIL,'YELLOW Crossword'));
  98.    END;
  99.    VAR
  100.       MYAPP:TMYAPP;
  101. BEGIN
  102.    MYAPP.INIT('Cryptic Crossword');
  103.    MYAPP.RUN;
  104.    MYAPP.DONE;
  105. END.
  106.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement