Discuss about Programming here. You may release your source, post guide and even ask questions!
Moderator: wizme
-
darknessproz
- Sacrificer

- Posts: 27
- Joined: Wed Jan 20, 2010 7:17 pm
Post
by darknessproz »
its basically setting var timer := 10, and use a timer to -1 every 1000 interval while updating the caption.
Code: Select all
procedure TForm1.Button1Click(Sender: TObject);
begin
Label2.Caption :='Active';
Button1.Enabled := False;
Button2.Enabled := True;
Timer1.Enabled := True;
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
Label2.Caption :='Inactive';
Button1.Enabled := True;
Button2.Enabled := False;
Timer1.Enabled := False;
end;
procedure TForm1.RadioButton1Click(Sender: TObject);
begin
timer := 10;
end;
procedure TForm1.RadioButton2Click(Sender: TObject);
begin
timer := 20;
end;
procedure TForm1.RadioButton3Click(Sender: TObject);
begin
timer := 30;
end;
procedure TForm1.Timer1Timer(Sender: TObject);
begin
timer := timer - 1;
Panel1.Caption := IntToStr(timer);
if timer = 0 then
begin
Timer1.Enabled := False;
end;
end;
-
wizme
- Destiny General

- Posts: 297
- Joined: Sat Sep 05, 2009 1:40 pm
Post
by wizme »
yea cheers =)
-
darknessproz
- Sacrificer

- Posts: 27
- Joined: Wed Jan 20, 2010 7:17 pm
Post
by darknessproz »
so boredness, is the way i'm doing it correct?
-
Boredness
- The Emperor

- Posts: 2539
- Joined: Wed Aug 26, 2009 9:50 pm
- Location: Singapore
-
Contact:
Post
by Boredness »
you did it wrongly.
you could use the caption and -1 to the value and stop the caption from going after 0.. like -1...
-
darknessproz
- Sacrificer

- Posts: 27
- Joined: Wed Jan 20, 2010 7:17 pm
Post
by darknessproz »
i stopped it from going to negative value by doing a if timer = 0 then Timer1.Enabled = False
does the way i'm doing it give rise to any major issues?
-
Boredness
- The Emperor

- Posts: 2539
- Joined: Wed Aug 26, 2009 9:50 pm
- Location: Singapore
-
Contact:
Post
by Boredness »
caption = 0 den disable... i'll show u the source...
anyways, what are you doing with it?
-
darknessproz
- Sacrificer

- Posts: 27
- Joined: Wed Jan 20, 2010 7:17 pm
Post
by darknessproz »
its sorta a parental control thing to shutdown the computer.
-
wizme
- Destiny General

- Posts: 297
- Joined: Sat Sep 05, 2009 1:40 pm
Post
by wizme »
darknessproz wrote:its sorta a parental control thing to shutdown the computer.
you sure u making a parental control to shut down coms or use it ask prank? lol
how old are you ?
-
darknessproz
- Sacrificer

- Posts: 27
- Joined: Wed Jan 20, 2010 7:17 pm
Post
by darknessproz »
lol 16, its sorta a fun thing, but for school as well.
-
Boredness
- The Emperor

- Posts: 2539
- Joined: Wed Aug 26, 2009 9:50 pm
- Location: Singapore
-
Contact:
Post
by Boredness »
lmao shut down a computer... nice