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.