Browse CVS Repository
Contents of /exerb/exerbtk/test/timer.rb
Parent Directory
| Revision Log
| Revision Graph
Revision 1.3 -
( show annotations)
( download)
Fri Feb 13 17:28:41 2004 UTC
(20 years, 1 month ago)
by yuya
Branch: MAIN
CVS Tags: HEAD
Changes since 1.2: +11 -11 lines
* 記述スタイルを変更
| 1 |
#! /usr/bin/ruby |
| 2 |
|
| 3 |
#==============================================================================# |
| 4 |
# $Id: timer.rb,v 1.2 2004/02/13 15:05:04 yuya Exp $ |
| 5 |
#==============================================================================# |
| 6 |
|
| 7 |
require 'etk/etk' |
| 8 |
|
| 9 |
#==============================================================================# |
| 10 |
|
| 11 |
class MyForm < Etk::Form |
| 12 |
|
| 13 |
def initialize |
| 14 |
self.set_client_size(150, 90) |
| 15 |
self << start = Etk::Button.new(:start, "Start", 10, 10, 130, 30) |
| 16 |
self << stop = Etk::Button.new(:stop, "Stop", 10, 50, 130, 30) |
| 17 |
|
| 18 |
$timer = Etk::Timer.new |
| 19 |
$timer.interval = 1000 |
| 20 |
$timer.start |
| 21 |
|
| 22 |
def $timer.on_tick(arg) |
| 23 |
p(:on_tick) |
| 24 |
end |
| 25 |
end |
| 26 |
|
| 27 |
def on_start_click(arg) |
| 28 |
p(:start) |
| 29 |
$timer.start |
| 30 |
end |
| 31 |
|
| 32 |
def on_stop_click(arg) |
| 33 |
p(:stop) |
| 34 |
$timer.stop |
| 35 |
end |
| 36 |
|
| 37 |
end |
| 38 |
|
| 39 |
#==============================================================================# |
| 40 |
|
| 41 |
Etk.main(MyForm.new) |
| 42 |
|
| 43 |
#==============================================================================# |
| 44 |
#==============================================================================# |
| |