2004-07-01 09:38:48 +00:00
|
|
|
#
|
|
|
|
# tkextlib/tcllib/datefield.rb
|
|
|
|
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
|
|
|
|
#
|
|
|
|
# * Part of tcllib extension
|
|
|
|
# * Tk datefield widget
|
|
|
|
#
|
|
|
|
# (The following is the original description of the library.)
|
|
|
|
#
|
|
|
|
# The datefield package provides the datefield widget which is an enhanced
|
|
|
|
# text entry widget for the purpose of date entry. Only valid dates of the
|
|
|
|
# form MM/DD/YYYY can be entered.
|
|
|
|
#
|
|
|
|
# The datefield widget is, in fact, just an entry widget with specialized
|
|
|
|
# bindings. This means all the command and options for an entry widget apply
|
|
|
|
# equally here.
|
|
|
|
|
|
|
|
require 'tk'
|
|
|
|
require 'tk/entry'
|
2004-07-06 09:42:12 +00:00
|
|
|
require 'tkextlib/tcllib.rb'
|
2004-07-01 09:38:48 +00:00
|
|
|
|
|
|
|
# TkPackage.require('datefield', '0.1')
|
|
|
|
TkPackage.require('datefield')
|
|
|
|
|
|
|
|
module Tk
|
|
|
|
module Tcllib
|
|
|
|
class Datefield < TkEntry
|
2005-05-30 14:53:52 +00:00
|
|
|
PACKAGE_NAME = 'datefield'.freeze
|
|
|
|
def self.package_name
|
|
|
|
PACKAGE_NAME
|
|
|
|
end
|
|
|
|
|
2004-07-06 09:42:12 +00:00
|
|
|
def self.package_version
|
2004-10-11 04:51:21 +00:00
|
|
|
begin
|
|
|
|
TkPackage.require('datefield')
|
|
|
|
rescue
|
|
|
|
''
|
|
|
|
end
|
2004-07-06 09:42:12 +00:00
|
|
|
end
|
2004-07-01 09:38:48 +00:00
|
|
|
end
|
|
|
|
DateField = Datefield
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
class Tk::Tcllib::Datefield
|
|
|
|
TkCommandNames = ['::datefield::datefield'.freeze].freeze
|
|
|
|
|
|
|
|
def create_self(keys)
|
|
|
|
if keys and keys != None
|
2005-04-09 09:27:54 +00:00
|
|
|
tk_call_without_enc(self.class::TkCommandNames[0], @path,
|
2004-10-11 04:51:21 +00:00
|
|
|
*hash_kv(keys, true))
|
2004-07-01 09:38:48 +00:00
|
|
|
else
|
2005-04-09 09:27:54 +00:00
|
|
|
tk_call_without_enc(self.class::TkCommandNames[0], @path)
|
2004-07-01 09:38:48 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
private :create_self
|
|
|
|
end
|