summaryrefslogtreecommitdiff
path: root/unit1.pas
blob: 05b97d8eabb16e4e64e65fd540f385c6ee7e05aa (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
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
  application.createForm(tForm2, form2);
  case form2.showmodal of
    mrBuchstabenraetsel:
      raetsel:=tBuchstabenRaetsel.create(form1);
    mrHochhausraetsel:
      raetsel:=tHochhausRaetsel.create(form1);
    else begin
      raetsel:=nil;
      application.terminate;
    end;
  end;
  raetsel.onSetCaption:=@onSetCaption;
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.