06-05-2010, 02:20 PM
06-05-2010, 02:37 PM
وعليكم السلام ورحمة الله وبركاته
كود :
var
I: Integer = 0;
//On Timer1Time
begin
if I = 10 then
Timer1.Enabled := False
else Inc(I);
end;06-05-2010, 05:00 PM
السلام عليكم ورحمة الله وبركاتة
لقد قمت بوضع الكود كما قلت و لكن لا يعمل و السبب:
![[صورة: Sans-titre.png]](http://shup.com/Shup/332374/Sans-titre.png)
لقد قمت بوضع الكود كما قلت و لكن لا يعمل و السبب:
كود :
[Error] Unit1.pas(28): Cannot initialize local variables![[صورة: Sans-titre.png]](http://shup.com/Shup/332374/Sans-titre.png)
06-05-2010, 06:45 PM
كتبت لك:
السطر:
اكتبه فوق 
إقتباس ://On Timer1Timeأي أن ما سيأتي من الكود تكتبه في OnTimerTime1
السطر:
كود :
I: Integer = 0;
06-05-2010, 08:00 PM
إقتباس :اكتبه فوق
الأخ كاش واحد يقصد بهذه الطريقة تقريبا,
PHP كود :
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls;
type
TForm1 = class(TForm)
Timer1: TTimer;
procedure Timer1Timer(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
i : integer = 0;
implementation
{$R *.dfm}
procedure TForm1.Timer1Timer(Sender: TObject);
begin
if i = 10 then
begin
timer1.Enabled := false;
Showmessage('Timer now is False');
end
else
inc(i);
end;
end.
بالتوفيق,
17-05-2010, 09:40 AM
هناك طريقة أخرى ...هي أن تضع خاصية Interval في التايمر 10 ثواني أي 10000
وتكتب الكود في Timer1Ontimer
فقط
وتكتب الكود في Timer1Ontimer
كود :
Timer1.Enabled := False;