A simple example of timer-reply to the question "timer008"

Source: Internet
Author: User
Problem Source: http://www.cnblogs.com/del/archive/2008/07/09/1073218.html#1249648
Code File:
Unit unit1; interfaceuses windows, messages, sysutils, variants, classes, graphics, controls, forms, dialogs, extctrls, stdctrls; Type tform1 = Class (tform) button1: tbutton; timer1: ttimer; Procedure formcreate (Sender: tobject); Procedure button1click (Sender: tobject); Procedure submit (Sender: tobject); end; var form1: tform1; implementation {$ R *. DFM} procedure tform1.formcreate (Sender: tobject); B Egin timer1.interval: = 15000; {the timer is executed once every 15 seconds} timer1.enabled: = false; {the timer is started directly by default. Close it first} end; Procedure tform1.button1click (Sender: tobject); begin {start timer} timer1.enabled: = true; {What is the function of clicking the button? For example, let the button title automatically count} button1.caption: = inttostr (strtointdef (button1.caption, 0) + 1); end; {regularly execute button1click} procedure tform1.timer1timer (Sender: tobject ); begin button1.click; end.

  

Form file:

 Object form1: tform1 left = 0 Top = 0 caption = 'form1 'clientheight = 206 clientwidth = 339 color = clbtnface font. charset = default_charset font. color = clwindowtext font. height =-11 font. name = 'tahoma 'font. style = [] oldcreateorder = false oncreate = formcreate pixelsperinch = 96 textheight = 13 object button1: tbutton left = 136 Top = 112 width = 75 Height = 25 caption = 'button1' taborder = 0 onclick = button1click end object timer1: ttimer ontimer = timer1timer left = 160 Top = 80 endend

   

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.