mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
581ca6097e
* ext/tk/lib/tk/optiondb.rb: support definition of command resources on widgets git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@6993 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
17 lines
690 B
Ruby
17 lines
690 B
Ruby
require 'tk'
|
|
TkOptionDB.readfile(File.expand_path('cmd_resource',
|
|
File.dirname(__FILE__)))
|
|
f = TkFrame.new(:class=>'BtnFrame').pack
|
|
b = TkButton.new(:parent=>f, :widgetname=>'hello').pack
|
|
cmd1 = TkOptionDB.new_proc_class(b, [:show_msg, :bye_msg], 3)
|
|
cmd2 = TkOptionDB.new_proc_class(:ZZZ, [:show_msg, :bye_msg], 3, false, cmd1)
|
|
cmd3 = TkOptionDB.new_proc_class(:ZZZ, [:show_msg, :bye_msg], 3, false, b)
|
|
cmd4 = TkOptionDB.new_proc_class(:BTN_CMD, [:show_msg, :bye_msg], 3){
|
|
def self.__check_proc_string__(str)
|
|
"{|arg| print [arg, $SAFE].inspect, ': '; Proc.new#{str}.call(arg)}"
|
|
end
|
|
}
|
|
cmd1.show_msg('cmd1')
|
|
cmd2.show_msg('cmd2')
|
|
cmd3.show_msg('cmd3')
|
|
cmd4.show_msg('cmd4')
|