Method: TkTimer#initialize
- Defined in:
- lib/tk/timer.rb
#initialize(*args, &b) ⇒ TkTimer
Returns a new instance of TkTimer.
148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 |
# File 'lib/tk/timer.rb', line 148 def initialize(*args, &b) Tk_CBID.mutex.synchronize{ # @id = Tk_CBID.join('') @id = Tk_CBID.join(TkCore::INTERP._ip_id_) Tk_CBID[1].succ! } @wait_var = TkVariable.new(0) @at_end_proc = nil @cb_cmd = TkCore::INTERP.get_cb_entry(self.method(:do_callback)) @set_next = true @init_sleep = 0 @init_proc = nil @init_args = [] @current_script = [] @current_proc = nil @current_args = nil @return_value = nil @sleep_time = 0 @current_sleep = 0 @loop_exec = 0 @do_loop = 0 @loop_proc = [] @proc_max = 0 @current_pos = 0 @after_id = nil @after_script = nil @cancel_on_exception = DEFAULT_IGNORE_EXCEPTIONS # Unless @cancel_on_exception, Ruby/Tk shows an error dialog box when # an exception is raised on TkTimer callback procedure. # If @cancel_on_exception is an array of exception classes and the raised # exception is included in the array, Ruby/Tk cancels executing TkTimer # callback procedures silently (TkTimer#cancel is called and no dialog is # shown). if b case args.size when 0 add_procs(b) when 1 args << -1 << b else args << b end end set_procs(*args) if args != [] @running = false @in_callback = false end |