Guidance
指路人
g.yi.org
software / RapidQ / RQ Doc / html / qtimer.html

Register 
注册
Search 搜索
首页 
Home Home
Software
Upload

  
Appendix A: QTIMER
Rapid-Q Documentation by William Yu (c)1999-2000 Appendix A: QTIMER


QTIMER Component

QTimer implements the Windows API timer functions.

QTimer Properties
FieldTypeR/WDefaultSupport





EnabledINTEGERRWTrueWXG
IntervalINTEGERRWWXG
Interval determines the amount of time, in milliseconds, that passes before the timer component initiates another OnTimer event.
TagINTEGERRWWXG


QTimer Events
EventTypeOccurs when...ParamsSupport





OnTimerVOIDTimer interval elaspes0WXG


QTimer Examples
' Timer & OnKeyPress example for Rapid-Q by William Yu
'       If no form is visible, Timer will not function.
'       Not for PURE CONSOLE apps, but you're allowed to MIX.

DIM Timer1 AS QTimer, Timer2 AS QTimer
DIM Form AS QFORM
DIM Label1 AS QLABEL, Label2 AS QLABEL
DIM Label3 AS QLABEL

SUB TimerOver
  Timer1.Interval = 100
  I = I + 1
  Label1.Caption = STR$(I)
END SUB

SUB Timer2Over
  Timer2.Interval = 1000
  J = J + 1
  Label2.Caption = STR$(J)
END SUB

SUB KeyPressed (Key AS BYTE)      '' Event returns one parameter
  IF UCASE$(CHR$(Key)) = "Q" THEN
    FORM.CLOSE
  END IF
END SUB

I = 0        ' Undeclared variables are automatically global!
J = 0

FORM.CAPTION = "Timer Example"
FORM.WIDTH = 150
FORM.HEIGHT = 120
FORM.CENTER

Label1.Parent = Form
Label1.Caption = STR$(I)
Label1.Left = FORM.WIDTH/2

Label2.Parent = Form
Label2.Caption = STR$(J)
Label2.Left = FORM.WIDTH/2
Label2.Top = 40

Label3.Parent = Form
Label3.Caption = "Press 'Q' to quit'
Label3.Top = 75

Timer1.Interval = 100
Timer1.Enabled = 1          ' True
Timer1.OnTimer = TimerOver

Timer2.Interval = 1000
Timer2.Enabled = 1          ' True
Timer2.OnTimer = Timer2Over

FORM.OnKeyPress = KeyPressed
FORM.SHOWMODAL

Prev Component Contents Next Component
掌柜推荐
 
 
¥289.00 ·
 
 
¥1,080.00 ·
 
 
¥1,380.00 ·
 
 
¥638.00 ·
 
 
¥1,290.00 ·
 
 
¥1,420.00 ·
© Sun 2024-11-24  Guidance Laboratory Inc.
Email:webmaster1g.yi.org Hits:0 Last modified:2015-12-25 19:42:49