summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2018-10-01 22:27:14 +0200
committerErich Eckner <git@eckner.net>2018-10-01 22:27:14 +0200
commit717b9418c82503d4eea96b2e736ba23e7134a1e3 (patch)
treeb5734efe15f4628cb64136aa5a2cfb5037a8450c
parentf6e4306d5b6faa060b89e46f3a79636270b49359 (diff)
downloadRaetsel-717b9418c82503d4eea96b2e736ba23e7134a1e3.tar.xz
Spielnummern neu
-rw-r--r--raetsel.lps88
-rw-r--r--raetselunit.pas24
-rw-r--r--unit1.pas7
3 files changed, 72 insertions, 47 deletions
diff --git a/raetsel.lps b/raetsel.lps
index ea83dbf..95f4b26 100644
--- a/raetsel.lps
+++ b/raetsel.lps
@@ -9,7 +9,7 @@
<IsPartOfProject Value="True"/>
<EditorIndex Value="2"/>
<CursorPos X="35" Y="10"/>
- <UsageCount Value="56"/>
+ <UsageCount Value="58"/>
<Loaded Value="True"/>
</Unit0>
<Unit1>
@@ -18,9 +18,9 @@
<ComponentName Value="Form1"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
- <TopLine Value="28"/>
- <CursorPos Y="52"/>
- <UsageCount Value="56"/>
+ <TopLine Value="36"/>
+ <CursorPos X="25" Y="59"/>
+ <UsageCount Value="58"/>
<Loaded Value="True"/>
</Unit1>
<Unit2>
@@ -32,16 +32,15 @@
<UnitName Value="Unit2"/>
<EditorIndex Value="-1"/>
<CursorPos Y="17"/>
- <UsageCount Value="55"/>
+ <UsageCount Value="57"/>
</Unit2>
<Unit3>
<Filename Value="raetselunit.pas"/>
<IsPartOfProject Value="True"/>
<IsVisibleTab Value="True"/>
<EditorIndex Value="1"/>
- <TopLine Value="795"/>
- <CursorPos Y="825"/>
- <UsageCount Value="50"/>
+ <CursorPos X="49" Y="35"/>
+ <UsageCount Value="52"/>
<Loaded Value="True"/>
</Unit3>
<Unit4>
@@ -50,7 +49,7 @@
<EditorIndex Value="3"/>
<TopLine Value="785"/>
<CursorPos Y="807"/>
- <UsageCount Value="36"/>
+ <UsageCount Value="38"/>
<Loaded Value="True"/>
</Unit4>
<Unit5>
@@ -90,9 +89,9 @@
<ResourceBaseClass Value="Form"/>
<UnitName Value="Unit1"/>
<EditorIndex Value="4"/>
- <TopLine Value="2283"/>
+ <TopLine Value="2341"/>
<CursorPos X="13" Y="2380"/>
- <UsageCount Value="19"/>
+ <UsageCount Value="20"/>
<Loaded Value="True"/>
</Unit10>
<Unit11>
@@ -126,122 +125,123 @@
</Units>
<JumpHistory Count="30" HistoryIndex="29">
<Position1>
- <Filename Value="raetselunit.inc"/>
- <Caret Line="799" TopLine="760"/>
+ <Filename Value="raetselunit.pas"/>
+ <Caret Line="395" Column="22" TopLine="360"/>
</Position1>
<Position2>
- <Filename Value="raetselunit.inc"/>
- <Caret Line="819" Column="65" TopLine="780"/>
+ <Filename Value="raetselunit.pas"/>
+ <Caret Line="396" Column="38" TopLine="361"/>
</Position2>
<Position3>
<Filename Value="raetselunit.pas"/>
- <Caret Line="345" Column="24" TopLine="307"/>
+ <Caret Line="397" Column="31" TopLine="374"/>
</Position3>
<Position4>
<Filename Value="raetselunit.pas"/>
- <Caret Line="372" Column="41" TopLine="346"/>
+ <Caret Line="398" Column="14" TopLine="374"/>
</Position4>
<Position5>
<Filename Value="raetselunit.pas"/>
- <Caret Line="738" Column="47" TopLine="711"/>
+ <Caret Line="399" Column="14" TopLine="374"/>
</Position5>
<Position6>
- <Filename Value="raetselunit.inc"/>
- <Caret Line="21" Column="15"/>
+ <Filename Value="raetselunit.pas"/>
+ <Caret Line="408" Column="39" TopLine="386"/>
</Position6>
<Position7>
<Filename Value="raetselunit.pas"/>
- <Caret Line="738" Column="47" TopLine="711"/>
+ <Caret Line="399" Column="27" TopLine="388"/>
</Position7>
<Position8>
<Filename Value="raetselunit.pas"/>
- <Caret Line="869" TopLine="838"/>
</Position8>
<Position9>
<Filename Value="raetselunit.pas"/>
- <Caret Line="888" Column="14" TopLine="825"/>
+ <Caret Line="43" Column="13" TopLine="7"/>
</Position9>
<Position10>
<Filename Value="raetselunit.pas"/>
+ <Caret Line="234" Column="11" TopLine="199"/>
</Position10>
<Position11>
<Filename Value="raetselunit.pas"/>
- <Caret Line="89" TopLine="81"/>
+ <Caret Line="235" Column="11" TopLine="200"/>
</Position11>
<Position12>
<Filename Value="raetselunit.pas"/>
- <Caret Line="735" TopLine="716"/>
+ <Caret Line="236" Column="11" TopLine="202"/>
</Position12>
<Position13>
<Filename Value="raetselunit.pas"/>
+ <Caret Line="237" Column="11" TopLine="203"/>
</Position13>
<Position14>
<Filename Value="raetselunit.pas"/>
- <Caret Line="89" TopLine="47"/>
+ <Caret Line="238" Column="11" TopLine="204"/>
</Position14>
<Position15>
<Filename Value="raetselunit.pas"/>
- <Caret Line="756" Column="66" TopLine="722"/>
+ <Caret Line="239" Column="11" TopLine="205"/>
</Position15>
<Position16>
<Filename Value="raetselunit.pas"/>
- <Caret Line="734" Column="8" TopLine="718"/>
+ <Caret Line="240" Column="11" TopLine="206"/>
</Position16>
<Position17>
- <Filename Value="raetselunit.inc"/>
- <Caret Line="816" Column="11" TopLine="785"/>
+ <Filename Value="raetselunit.pas"/>
+ <Caret Line="408" Column="39" TopLine="373"/>
</Position17>
<Position18>
<Filename Value="raetselunit.pas"/>
- <Caret Line="369" Column="19" TopLine="349"/>
+ <Caret Line="43" Column="13" TopLine="21"/>
</Position18>
<Position19>
<Filename Value="raetselunit.pas"/>
- <Caret Line="47" TopLine="40"/>
+ <Caret Line="238" Column="18" TopLine="203"/>
</Position19>
<Position20>
<Filename Value="raetselunit.pas"/>
- <Caret Line="202" Column="47" TopLine="186"/>
+ <Caret Line="240" Column="42" TopLine="217"/>
</Position20>
<Position21>
<Filename Value="raetselunit.pas"/>
- <Caret Line="7"/>
+ <Caret Line="234" Column="29" TopLine="217"/>
</Position21>
<Position22>
<Filename Value="raetselunit.pas"/>
- <Caret Line="67" Column="20" TopLine="31"/>
+ <Caret Line="59" Column="21" TopLine="39"/>
</Position22>
<Position23>
<Filename Value="raetselunit.pas"/>
- <Caret Line="103" Column="20" TopLine="67"/>
+ <Caret Line="93" Column="21" TopLine="57"/>
</Position23>
<Position24>
<Filename Value="raetselunit.pas"/>
- <Caret Line="230" Column="27" TopLine="195"/>
+ <Caret Line="326" Column="4" TopLine="305"/>
</Position24>
<Position25>
<Filename Value="raetselunit.pas"/>
- <Caret Line="349" Column="14" TopLine="311"/>
+ <Caret Line="328" Column="36" TopLine="305"/>
</Position25>
<Position26>
- <Filename Value="raetselunit.pas"/>
- <Caret Line="67" Column="20" TopLine="47"/>
+ <Filename Value="unit1.pas"/>
+ <Caret Line="52" TopLine="28"/>
</Position26>
<Position27>
<Filename Value="raetselunit.pas"/>
- <Caret Line="103" Column="20" TopLine="67"/>
+ <Caret Line="327" Column="3" TopLine="306"/>
</Position27>
<Position28>
<Filename Value="raetselunit.pas"/>
- <Caret Line="230" Column="27" TopLine="195"/>
+ <Caret Line="35" Column="39" TopLine="19"/>
</Position28>
<Position29>
<Filename Value="raetselunit.pas"/>
- <Caret Line="346" Column="10" TopLine="311"/>
+ <Caret Line="331" Column="43" TopLine="308"/>
</Position29>
<Position30>
<Filename Value="raetselunit.pas"/>
- <Caret Line="373" Column="25" TopLine="339"/>
+ <Caret Line="330" Column="14" TopLine="309"/>
</Position30>
</JumpHistory>
</ProjectSession>
diff --git a/raetselunit.pas b/raetselunit.pas
index 4e0ffae..04052b9 100644
--- a/raetselunit.pas
+++ b/raetselunit.pas
@@ -4,8 +4,6 @@ unit raetselunit;
interface
-// TODO: Spielnummernzufall
-
// TODO: Cross-Compilieren
uses
@@ -32,6 +30,8 @@ type
vorherMalFarbe: TColor;
end;
+ tOnSetCaption = procedure(c: string) of object;
+
tRaetsel = class
private
besitzer: tForm;
@@ -40,6 +40,7 @@ type
erzeugeBtn,
speichernBtn,
ladenBtn: tButtonWithArrowKeys;
+ zufallSE: tSpinEdit;
progressbar1: tProgressBar;
aktuelleFarbe: tColor;
function besitzerHoehe: longint; dynamic;
@@ -66,6 +67,7 @@ type
procedure speichern(var datei: file); dynamic;
procedure laden(var datei: file); dynamic;
public
+ onSetCaption: tOnSetCaption;
constructor create(aOwner: tForm);
destructor destroy; override;
procedure zeichnen; dynamic; abstract;
@@ -230,6 +232,16 @@ begin
ladenBtn.caption:='Laden!';
ladenBtn.onClick:=@ladenOnClick;
ladenBtn.onKeyDown:=@onKeyDown;
+ zufallSE:=tSpinEdit.create(besitzer);
+ zufallSE.parent:=besitzer;
+ zufallSE.top:=erzeugeBtn.top+erzeugeBtn.height+spacing;
+ zufallSE.left:=spacing;
+ zufallSE.width:=64;
+ zufallSE.minValue:=0;
+ zufallSE.maxValue:=99999;
+ zufallSE.value:=random(zufallSE.maxValue+1);
+ zufallSE.showHint:=true;
+ zufallSE.hint:='Nummer';
progressbar1:=tProgressBar.create(besitzer);
progressbar1.visible:=false;
progressbar1.parent:=besitzer;
@@ -312,6 +324,10 @@ end;
procedure tRaetsel.erzeugeOnClick(sender: tObject);
begin
loeschen;
+ randSeed:=zufallSE.value;
+ if assigned(onSetCaption) then
+ onSetCaption(intToStr(zufallSE.value));
+ zufallSE.value:=random(zufallSE.maxValue+1);
loesen(-1);
randErzeugen;
leeren;
@@ -396,7 +412,9 @@ begin
with spinEdits[i] do begin
parent:=besitzer;
top:=erzeugeBtn.top+erzeugeBtn.height+spacing;
- if i>0 then begin
+ if i=0 then
+ left:=zufallSE.left + zufallSE.width
+ else begin
left:=spinEdits[i-1].left + spinEdits[i-1].width;
value:=groeszen[i-1];
end;
diff --git a/unit1.pas b/unit1.pas
index 27ec7c2..05b97d8 100644
--- a/unit1.pas
+++ b/unit1.pas
@@ -19,6 +19,7 @@ type
private
{ private declarations }
procedure WMGetDlgCode(var msg: tMessage); message WM_GETDLGCODE;
+ procedure onSetCaption(c: string);
public
{ public declarations }
raetsel: tRaetsel;
@@ -55,6 +56,12 @@ begin
application.terminate;
end;
end;
+ raetsel.onSetCaption:=@onSetCaption;
+end;
+
+procedure tForm1.onSetCaption(c: string);
+begin
+ form1.caption:=c;
end;
procedure tForm1.FormDestroy(Sender: TObject);