class Tk::Scale
Constants
- TkCommandNames
- WidgetClassName
Public Instance Methods
command(cmd=Proc.new)
click to toggle source
# File lib/tk/scale.rb, line 80 def command(cmd=Proc.new) configure('command'=>cmd) end
configure(slot, value=None)
click to toggle source
Calls superclass method
TkConfigMethod#configure
# File lib/tk/scale.rb, line 69 def configure(slot, value=None) if (slot == 'command' || slot == :command) configure('command'=>value) elsif slot.kind_of?(Hash) && (slot.key?('command') || slot.key?(:command)) slot = _symbolkey2str(slot) slot['command'] = _wrap_command_arg(slot.delete('command')) end super(slot, value) end
configure_cmd(slot, value)
click to toggle source
# File lib/tk/scale.rb, line 65 def configure_cmd(slot, value) configure(slot=>value) end
coords(val=None)
click to toggle source
# File lib/tk/scale.rb, line 88 def coords(val=None) tk_split_list(tk_send_without_enc('coords', val)) end
get(x=None, y=None)
click to toggle source
# File lib/tk/scale.rb, line 84 def get(x=None, y=None) number(tk_send_without_enc('get', x, y)) end
identify(x, y)
click to toggle source
# File lib/tk/scale.rb, line 92 def identify(x, y) tk_send_without_enc('identify', x, y) end
set(val)
click to toggle source
# File lib/tk/scale.rb, line 96 def set(val) tk_send_without_enc('set', val) end
value()
click to toggle source
# File lib/tk/scale.rb, line 100 def value get end
value=(val)
click to toggle source
# File lib/tk/scale.rb, line 104 def value= (val) set(val) val end
Private Instance Methods
__strval_optkeys()
click to toggle source
Calls superclass method
TkConfigMethod#__strval_optkeys
# File lib/tk/scale.rb, line 49 def __strval_optkeys super() << 'label' end
_wrap_command_arg(cmd)
click to toggle source
# File lib/tk/scale.rb, line 54 def _wrap_command_arg(cmd) proc{|val| if val.kind_of?(String) cmd.call(number(val)) else cmd.call(val) end } end
create_self(keys)
click to toggle source
# File lib/tk/scale.rb, line 11 def create_self(keys) if keys and keys != None if keys.key?('command') && ! keys['command'].kind_of?(String) cmd = keys.delete('command') keys['command'] = proc{|val| cmd.call(val.to_f)} end unless TkConfigMethod.__IGNORE_UNKNOWN_CONFIGURE_OPTION__ #tk_call_without_enc('scale', @path, *hash_kv(keys, true)) tk_call_without_enc(self.class::TkCommandNames[0], @path, *hash_kv(keys, true)) else begin tk_call_without_enc(self.class::TkCommandNames[0], @path, *hash_kv(keys, true)) rescue tk_call_without_enc(self.class::TkCommandNames[0], @path) keys = __check_available_configure_options(keys) unless keys.empty? begin tk_call_without_enc('destroy', @path) rescue # cannot destroy configure(keys) else # re-create widget tk_call_without_enc(self.class::TkCommandNames[0], @path, *hash_kv(keys, true)) end end end end else #tk_call_without_enc('scale', @path) tk_call_without_enc(self.class::TkCommandNames[0], @path) end end