Method: TkComposite#configure
- Defined in:
- lib/tk/composite.rb
#configure(slot, value = None) ⇒ Object
def cget(slot)
slot = slot.to_s
if @option_methods.include?(slot)
if @option_methods[slot][:cget]
return self.__send__(@option_methods[slot][:cget])
else
if @option_setting[slot]
return @option_setting[slot]
else
return ''
end
end
end
tbl = @delegates[slot]
tbl = @delegates['DEFAULT'] unless tbl
begin
if tbl
opt, wins = tbl[-1]
opt = slot if opt == 'DEFAULT'
if wins && wins[-1]
return wins[-1].cget(opt)
end
end
rescue
end
super(slot)
end
295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 |
# File 'lib/tk/composite.rb', line 295 def configure(slot, value=None) if slot.kind_of? Hash slot.each{|slot,value| configure slot, value} return self end slot = slot.to_s if @option_methods.include?(slot) unless @option_methods[slot][:cget] if value.kind_of?(Symbol) @option_setting[slot] = value.to_s else @option_setting[slot] = value end end return self.__send__(@option_methods[slot][:set], value) end tbl = @delegates[slot] tbl = @delegates['DEFAULT'] unless tbl begin if tbl last = nil tbl.each{|opt, wins| opt = slot if opt == 'DEFAULT' wins.each{|w| last = w.configure(opt, value)} } return last end rescue end super(slot, value) end |