diff options
Diffstat (limited to 'ext/tk/sample/demos-en/timer')
-rw-r--r-- | ext/tk/sample/demos-en/timer | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/ext/tk/sample/demos-en/timer b/ext/tk/sample/demos-en/timer index 896568c0b..58a41d00c 100644 --- a/ext/tk/sample/demos-en/timer +++ b/ext/tk/sample/demos-en/timer @@ -80,12 +80,28 @@ end class ButtonFrame < TkFrame def initialize(parent=nil,keys=nil) super(parent,keys) +=begin @stop = TkButton.new(self, 'text'=>'Stop', 'command'=>proc{timer_stop}) @start = TkButton.new(self, 'text'=>'Start', 'command'=>proc{timer_start}) +=end + @stop = TkButton.new(self, :text=>'Stop', :state=>:disabled) + @start = TkButton.new(self, :text=>'Start', :state=>:normal) + + @stop.command proc{ + timer_stop + @start.state(:normal) + @stop.state(:disabled) + } + @start.command proc{ + timer_start + @stop.state(:normal) + @start.state(:disabled) + } + @reset = TkButton.new(self, 'text'=>'Reset', 'command'=>proc{timer_reset}) @@ -99,8 +115,8 @@ end class Timer < TkRoot attr_reader :countframe - def initialize - super + def initialize(*args) + super(*args) @countframe = CountFrame.new(self) @buttonframe = ButtonFrame.new(self) for f in [@buttonframe,@countframe] |