summaryrefslogtreecommitdiff
path: root/unit1.pas
blob: e8132be13339e5f8dbd1897397442ea10ed88691 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
unit unit1;

{$mode objfpc}{$H+}

interface

uses
  Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, ExtCtrls,
  raetselunit, StdCtrls, Messages, LCLType;

type

  { tForm1 }

  tForm1 = class(tForm)
    procedure formCreate(sender: tObject);
    procedure formDestroy(sender: tObject);
    procedure formShow(sender: tObject);
  private
    { private declarations }
    procedure wMGetDlgCode(var msg: tMessage); message wM_GETDLGCODE;
    procedure onSetCaption(c: string);
  public
    { public declarations }
    raetsel: tRaetsel;
  end;

var
  form1: tForm1;

implementation

{$R *.lfm}

uses
  unit2;

// tForm1 **********************************************************************

procedure tForm1.wMGetDlgCode(var msg: tMessage);// message wM_GETDLGCODE;
begin
  inherited;
  msg.result := msg.result or DLGC_WANTARROWS;
end;

procedure tForm1.formCreate(sender: tObject);
begin
  {$IFDEF DEBUG}
  writeln('procedure tForm1.formCreate(sender: tObject);');
  {$ENDIF}
  application.createForm(tForm2, form2);
  {$IFDEF DEBUG}
  writeln('application.createForm(tForm2, form2);');
  {$ENDIF}
  form2.left:=(screen.width-form2.width) div 2;
  form2.top:=(screen.height-form2.height) div 2;
  case form2.showmodal of
    mrBuchstabenraetsel:
      raetsel:=tBuchstabenRaetsel.create(form1);
    mrHochhausraetsel:
      raetsel:=tHochhausRaetsel.create(form1);
    else begin
      raetsel:=nil;
      application.terminate;
      exit;
    end;
  end;
  raetsel.onSetCaption:=@onSetCaption;
  left:=(screen.width-width) div 2;
  top:=(screen.height-height) div 2;
end;

procedure tForm1.onSetCaption(c: string);
begin
  form1.caption:=c;
end;

procedure tForm1.formDestroy(sender: tObject);
begin
  raetsel.free;
end;

procedure tForm1.formShow(sender: tObject);
begin
  if assigned(raetsel) then
    raetsel.zeichnen;
end;

end.