2 # tk/radiobutton.rb : treat radiobutton widget
7 class Tk::RadioButton<Tk::Button
8 TkCommandNames = ['radiobutton'.freeze].freeze
9 WidgetClassName = 'Radiobutton'.freeze
10 WidgetClassNames[WidgetClassName] = self
11 #def create_self(keys)
12 # if keys and keys != None
13 # tk_call_without_enc('radiobutton', @path, *hash_kv(keys, true))
15 # tk_call_without_enc('radiobutton', @path)
21 super() << 'indicatoron'
23 private :__boolval_optkeys
26 super() << 'selectcolor'
28 private :__strval_optkeys
30 def __ruby2val_optkeys # { key=>proc, ... }
32 'variable'=>proc{|v| tk_trace_variable(v)} # for backward compatibility
35 private :__ruby2val_optkeys
39 tk_send_without_enc('deselect')
43 tk_send_without_enc('select')
48 var = tk_send_without_enc('cget', '-variable')
49 if TkVariable::USE_TCLs_SET_VARIABLE_FUNCTIONS
50 _fromUTF8(INTERP._get_global_var(var))
52 INTERP._eval(Kernel.format('global %s; set %s', var, var))
57 var = tk_send_without_enc('cget', '-variable')
58 if TkVariable::USE_TCLs_SET_VARIABLE_FUNCTIONS
59 _fromUTF8(INTERP._set_global_var(var, _get_eval_string(val, true)))
61 s = '"' + _get_eval_string(val).gsub(/[\[\]$"\\]/, '\\\\\&') + '"'
62 INTERP._eval(Kernel.format('global %s; set %s %s', var, var, s))
67 Tk::Radiobutton = Tk::RadioButton
68 #TkRadioButton = Tk::RadioButton unless Object.const_defined? :TkRadioButton
69 #TkRadiobutton = Tk::Radiobutton unless Object.const_defined? :TkRadiobutton
70 Tk.__set_toplevel_aliases__(:Tk, Tk::RadioButton,
71 :TkRadioButton, :TkRadiobutton)