TkTimer#wait recieves the exception of the callback.
The exception is kept on @return_value.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5037 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* replace Tcl/Tk's vwait and tkwait to switch on threads smoothly and
avoid seg-fault.
* add TclTkIp._thread_vwait and _thread_tkwait for waiting on a thread.
( Because Tcl/Tk's vwait and tkwait command wait on a eventloop. )
ext/tk/lib/multi-tk.rb:
* support TclTkIp._thread_vwait and _thread_tkwait
ext/tk/lib/tk.rb:
* now, TkVariable#wait has 2 arguments.
If 1st argument is true, waits on a thread. If false, waits on an eventloop.
If 2nd argument is true, checks existence of rootwidgets. If false, doesn't.
Default is wait(true, false).
* add TkVariable#tkwait(arg) which is equal to TkVariable#wait(arg, true)
* wait_visibility and wait_destroy have an argument for waiting on a
thread or an eventloop.
* improve of accessing Tcl/Tk's special variables
ext/tk/lib/tkafter.rb:
* support 'wait on a thread' and 'wait on an eventloop'
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4762 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* (bug fix) some widget demos
* support <TkVariable object> == <Symbol>
( "coerce TkVariable" add to the TODO list :-) )
* freeze some object for security reason
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4282 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* better support for widgets created on Tk interpreter (without Ruby)
* a little more stable on Multiple Tk interpreters running
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4242 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
tcltklib.c : add some methods to support multiple interpreters (low level)
MANUAL.euc : modify descriptions
tcltklib/sample/safeTk.rb : (new) sample : how to use safeTk interpreter
tk/sample/safe-tk.rb : (new) sample : how to use multi-tk.rb
tk.rb, tkafter.rb : bug fix and add feature to supprt multi-tk
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4186 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
MANUAL.euc : modify descriptions
tk.rb : bug fix [ruby-talk:76980] and modify to support multi Tk IPs
tkafter.rb : modify to support multi Tk IPs
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4163 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* remove direct-accesses to a TkComm::INTERP
* remove direct-accesses to a TkComm::INITIALIZE_TARGETS
* use TkINTERP_SETUP_SCRIPTS constant for setting up the interpreter
tcltklib.c :
* support to create a safe interpreter with safe-Tk ( Tk8.x )
you can test it by the following
---------------------------------------------
require 'tk'
safeip = Tk::INTERP._eval('::safe::interpCreate')
Tk::INTERP._eval('::safe::loadTk ' + safeip)
Tk::INTERP._eval(safeip + ' eval button .b -text SlaveIP -command exit')
Tk::INTERP._eval(safeip + ' eval pack .b')
Tk.mainloop
---------------------------------------------
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3971 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* lib_do_one_event() : change default value of the argument
* lib_do_one_event() : returns true/false
* add TclTkLib::EventFlag::NONE ( == 0 )
* add set_no_event_wait() and get_no_event_wait()
* modify MANUAL.euc and README.euc
tk.rb :
* change default value of TkCore.do_one_event argument
* add TkCore.set_no_event_wait(wait) and TkCore.get_no_event_wait
* add Tk.exit ( == destroy root widget )
tkafter.rb :
* rename TkAfter => TkTimer ( TkAfter is an alias name now. )
* set_callback returns self
* continue() raises an exception, if already running or no procedure.
* skip() raises an exception, if not running.
sample/tktimer2.rb
* new sample for TkTimer class.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3965 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* small bug fix
* rename 'no_create' option to 'without_creating'
* add TkWindow#pack_in, TkWindow#grid_in, TkWindow#place_in
* add TkWindow#bind_class and TkWindow#database_class
If defined specific_class (@db_class), bind_class returns @db_class.
In other case, bind_class returns TkWinow#class().
It is useful for binding.
TkWindow#database_class is defined for querying the option database.
It's same to TkWinfo.classname(self).
* add TkBindTag.new_by_name and TkDatabaseClass for binding to database class
* check varname whether already exsist or not. (TkVarAccess.new)
* TkTextWin#bbox returns an array of four numbers
* autoload TkDialog2, TkWarning2
* scan event callback arguments and convert to proper type
* TkBindTag.new accepts a block ( TkBindTag.new(context){callback} )
* If given taglist, TkWindow#bindtags(taglist) returns taglist
* add TkWindow#bindtags=(taglist)
* Tk.focue and Tk.focus_lastfor return nil if there is no target widget.
* Tk::Wm.client returns the argument string when setting name
* TkGrid.columnconfiginfo and rowconfiginfo given a slot return a number.
* TkWindow.grid_columnconfiginfo and grid_rowconfiginfo :: ditto
* rename and define alias :: TkOption ==> TkOptionDB
* define alias :: TkTimer ==> TkAfter
* some instance methods change from public to private
* some TkComm methods change to module functions
(help to treat return values from Tk)
* add support for -displayof option to some TkWinfo methods
* bind, bind_append and bind_remove :: returns the target of event-binding
* add Tk8.4 features
* add TkPaneWindow
tkdialog.rb:
* classes without showing at initialize : TkDialog2, TkWarning2
* add show method to reuse TkDialog object
* some instance methods change from public to private
* add new features for configuration
tktext.rb :
* small bug fix
* some methods return self
* add TkTextMark#+(mod) and TkTextMark#-(mod) (e.g. mark + '3 chars')
* add some methods
tkcanvas.rb :
* small bug fix
* some methods return self
tkentry.rb :
* some methods return self
* TkEntry#bbox returns an array of four numbers
* scan validatecommand arguments and convert to proper type
tkbgerror.rb :
* support to define a error handler by user
tcltklib.rb :
* reported by Ferenc Engard <engard@all.hu> on [ruby-talk:60759]
... and so on
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3960 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* tkafter.rb: Add self to 1st argument of interval- and loop-proc
TkAfter#current_interval returns an interval (sleep) time value
TkAfter#current_args returns an array of arguments
TkAfter#return_value returns a return value of last loop-proc
e.g.
TkAfter.new(
proc{|obj| 500 - obj.current_interval}, 10,
[proc{|obj| p obj.current_args}, 'proc', 1],
proc{|obj| p obj.current_args; ['return', 2]},
[proc{|obj|
p obj.return_value
p ['proc', obj.current_args[0].call(obj.return_value[1],
obj.current_args[1])]},
proc{|*args| args[0] + args[1]}, 1],
proc{p ['proc', 4]} ).start(100)
* tk*.rb: Allow to use Symbols for parameters.
Allow new notation of constructor (also allow old notation).
e.g.
TkFrame.new('classname'=>'User'){|base|
pack
f = TkFrame.new(base, :classname=>'ButtonFrame').pack
TkButton.new(
:parent => f,
:text => 'Quit',
:command => proc{exit}
).pack(
:fill => :x,
:pady => 2
)
}
* tkcanvas.rb: (TkcItem) Add 'coords' parameter to the canvas item
constructor (for new notation of constructor).
e.g.
c = TkCanvas.new.pack
l = TkcLine.new(c, :coords=>[[0,0], [100,100]])
* tcltklib.c: New 'mainloop' and 'mainloop_watchdog'.
The priority of their event-loop can be controlled.
They accept an optional argument.
If it false, they don't exit although the root widget is destroyed.
This function is sometimes useful, if it is used with 'restart'.
'mainloop' can't treat Thread#join/value in a callback routine.
(e.g. TkButton.new(:command=>proc{p Thread.new{button.invoke}.value}) )
'mainloop_watchdog' can treat them, but watchdog thread is always running
(so, a little heavier than 'mainloop').
If the purpose of using Thread#join/value is to do something under some
safe-level, please use Proc object.
(e.g. :command=>proc{$SAFE=1;proc{$SAFE=2;button.invoke}.call;p $SAFE})
* tk.rb: Support functions of new 'mainloop' and 'mainloop_watchdog'.
* tk.rb: (Tk.restart) Add 'app-name' paramater and 'use' parameter.
'app-name' specifies the name and the resource class of the
application. If 'app-name' is specified to 'xxx', the application
class on the resource database is set to 'Xxx' and the application
name is changed by the same rule of Tk.appname method. 'use'
specifies the main window for embedding the root widget instead of
generating a new window.
* tk.rb: Add new parameter 'widgetname' to the widget constructor to
support effective use of Resource Database. For example, the
resource 'Xxx*quit.text: QUIT' can set the text of the button
generated by the following code.
e.g.
Tk.restart('Xxx')
TkButton.new(nil, 'widgetname'=>'quit', 'command'=>proc{exit}).pack
Tk.mainloop
* tk.rb: TkOption::get always returns a tainted string.
Add TkOption::new_proc_class.
It generates a class to import procedures defined on the resource
database. For example, there is a following resource file.
----< resource-test >------------
*CMD.foo: {|*args| p [$SAFE, :foo, args]}
*CMD.XXX.bar: {|*args| p [$SAFE, :bar, args]}
*Button.command: ruby {p self; p $SAFE; TkOption::CMD::XXX.bar(1,2,3)}
---------------------------------
The following code is a sample of use of the resource file.
e.g.
require 'tk'
TkOption.readfile 'resource-test'
p TkOption.new_proc_class(:CMD, [:foo], 1)
p TkOption.new_proc_class(:XXX, [:bar], 2, false, TkOption::CMD)
TkButton.new(:text=>'test').pack
Tk.mainloop
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2515 b2dd03c8-39d4-4d8f-98ff-823fe69b080e