1999-08-13 01:37:52 -04:00
|
|
|
#
|
|
|
|
# tkentry.rb - Tk entry classes
|
|
|
|
# $Date$
|
|
|
|
# by Yukihiro Matsumoto <matz@caelum.co.jp>
|
|
|
|
|
|
|
|
require 'tk.rb'
|
|
|
|
|
|
|
|
class TkEntry<TkLabel
|
|
|
|
WidgetClassName = 'Entry'.freeze
|
1999-08-24 04:21:56 -04:00
|
|
|
WidgetClassNames[WidgetClassName] = self
|
1999-08-13 01:37:52 -04:00
|
|
|
def self.to_eval
|
|
|
|
WidgetClassName
|
|
|
|
end
|
|
|
|
|
|
|
|
def create_self
|
|
|
|
tk_call 'entry', @path
|
|
|
|
end
|
1999-12-01 04:24:48 -05:00
|
|
|
def xscrollcommand(cmd=Proc.new)
|
|
|
|
configure_cmd 'xscrollcommand', cmd
|
1999-08-13 01:37:52 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
def delete(s, e=None)
|
|
|
|
tk_send 'delete', s, e
|
|
|
|
end
|
|
|
|
|
|
|
|
def cursor
|
|
|
|
tk_send 'index', 'insert'
|
|
|
|
end
|
|
|
|
def cursor=(index)
|
|
|
|
tk_send 'icursor', index
|
|
|
|
end
|
|
|
|
def index(index)
|
|
|
|
number(tk_send('index', index))
|
|
|
|
end
|
|
|
|
def insert(pos,text)
|
|
|
|
tk_send 'insert', pos, text
|
|
|
|
end
|
|
|
|
def mark(pos)
|
|
|
|
tk_send 'scan', 'mark', pos
|
|
|
|
end
|
|
|
|
def dragto(pos)
|
|
|
|
tk_send 'scan', 'dragto', pos
|
|
|
|
end
|
|
|
|
def selection_adjust(index)
|
|
|
|
tk_send 'selection', 'adjust', index
|
|
|
|
end
|
|
|
|
def selection_clear
|
1999-12-01 04:24:48 -05:00
|
|
|
tk_send 'selection', 'clear'
|
1999-08-13 01:37:52 -04:00
|
|
|
end
|
|
|
|
def selection_from(index)
|
|
|
|
tk_send 'selection', 'from', index
|
|
|
|
end
|
|
|
|
def selection_present()
|
|
|
|
tk_send('selection', 'present') == 1
|
|
|
|
end
|
|
|
|
def selection_range(s, e)
|
|
|
|
tk_send 'selection', 'range', s, e
|
|
|
|
end
|
|
|
|
def selection_to(index)
|
|
|
|
tk_send 'selection', 'to', index
|
|
|
|
end
|
|
|
|
def xview(*index)
|
|
|
|
tk_send 'xview', *index
|
|
|
|
end
|
|
|
|
|
|
|
|
def value
|
|
|
|
tk_send 'get'
|
|
|
|
end
|
|
|
|
def value= (val)
|
|
|
|
tk_send 'delete', 0, 'end'
|
|
|
|
tk_send 'insert', 0, val
|
|
|
|
end
|
|
|
|
end
|