Skip to content

Commit 4b2f0e6

Browse files
committed
Added Extract Number on Button DBLClick
1 parent 4110ffa commit 4b2f0e6

File tree

2 files changed

+25
-7
lines changed

2 files changed

+25
-7
lines changed

tombolamax_main.lfm

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ object FormTombola: TFormTombola
3030
end
3131
object ToolButton1: TToolButton
3232
Left = 100
33-
Height = 40
33+
Height = 8
3434
Top = 2
3535
Caption = 'ToolButton1'
3636
Style = tbsSeparator
@@ -43,7 +43,7 @@ object FormTombola: TFormTombola
4343
end
4444
object ToolButton2: TToolButton
4545
Left = 219
46-
Height = 40
46+
Height = 8
4747
Top = 2
4848
Caption = 'ToolButton2'
4949
Style = tbsSeparator
@@ -335,6 +335,7 @@ object FormTombola: TFormTombola
335335
Font.Height = 20
336336
Visible = False
337337
ParentFont = False
338+
OnMouseUp = buttonMouseUp
338339
TextAutoSize = True
339340
Toggle = False
340341
Pressed = False

tombolamax_main.pas

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,8 @@ TFormTombola = class(TForm)
6363
procedure btGioca2DblClick(Sender: TObject);
6464
procedure btRipetoClick(Sender: TObject);
6565
procedure btSelTab1Click(Sender: TObject);
66+
procedure buttonMouseUp(Sender: TObject; Button: TMouseButton;
67+
Shift: TShiftState; X, Y: Integer);
6668
procedure FormCreate(Sender: TObject);
6769
procedure FormResize(Sender: TObject);
6870
procedure lbEstrattoClick(Sender: TObject);
@@ -144,7 +146,12 @@ procedure TFormTombola.tbInfoClick(Sender: TObject);
144146
end;
145147

146148
procedure TFormTombola.Estrai(ANumero: Integer);
149+
var
150+
strNumero: String;
151+
147152
begin
153+
strNumero:=IntToStr(ANumero);
154+
148155
if (buttons[ANumero].Tag = 0) then
149156
begin
150157
Inc(cEstratti);
@@ -164,14 +171,15 @@ procedure TFormTombola.Estrai(ANumero: Integer);
164171
end;
165172
Estratti[0] :=ANumero;
166173

167-
buttons[edEstratto.Value].StateNormal.Color :=clRed;
168-
buttons[edEstratto.Value].Tag := 1;
174+
buttons[ANumero].StateNormal.Color :=clRed;
175+
buttons[ANumero].Tag := 1;
176+
edEstratto.Value:=ANumero;
169177
lbEstrattoUltimo.Visible :=True;
170-
lbEstratto.Caption :=IntToStr(ANumero);
178+
lbEstratto.Caption :=strNumero;
171179

172-
PlayFile(IntToStr(ANumero));
180+
PlayFile(strNumero);
173181
end
174-
else MessageDlg('Numero '+IntToStr(ANumero)+' già estratto', mtError, [mbOk], 0);
182+
else MessageDlg('Numero '+strNumero+' già estratto', mtError, [mbOk], 0);
175183
end;
176184

177185
procedure TFormTombola.PlayFile(AName: String);
@@ -206,6 +214,7 @@ procedure TFormTombola.FormCreate(Sender: TObject);
206214
buttons[i].ParentFont:=False;
207215
buttons[i].Tag:=0; //Non estratto
208216
buttons[i].Parent :=bcTabellone;
217+
buttons[i].OnMouseUp:= @buttonMouseUp;
209218
inc(i);
210219
end;
211220
end;
@@ -295,6 +304,14 @@ procedure TFormTombola.btSelTab1Click(Sender: TObject);
295304
else lastDown :=nil;
296305
end;
297306

307+
procedure TFormTombola.buttonMouseUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
308+
begin
309+
if (TColorSpeedButton(Sender).Tag = 0) and (ssDouble in Shift) then
310+
begin
311+
Estrai(StrToInt(TColorSpeedButton(Sender).Caption));
312+
end;
313+
end;
314+
298315
procedure TFormTombola.btEstraiClick(Sender: TObject);
299316
begin
300317
Estrai(edEstratto.Value);

0 commit comments

Comments
 (0)