pstoring a tkvariable 
Author Message
 pstoring a tkvariable

This is probably due to some internal working with TkVariables, but can someone
enlighten me as to why this won't work?

[test2.rb]
require 'pstore'
require 'tk'

db = PStore.new("temp")
test = nil
db.transaction {
  test = db.root?("foo") ? db["foo"] : TkVariable.new

Quote:
}

puts "type: #{test.type}"
puts "value: #{test.value}"

test.value = "hello world"
db.transaction {
  db["foo"] = test

Quote:
}

normsu[116]$ ruby test2.rb
type: TkVariable
value:
normsu[117]$ ruby test2.rb
type: TkVariable
/usr/local/lib/ruby/1.6/tk.rb:977:in `_eval': can't read "v00000": no such
variable (RuntimeError)
        from /usr/local/lib/ruby/1.6/tk.rb:977:in `_eval'
        from /usr/local/lib/ruby/1.6/tk.rb:1160:in `value'
        from test2.rb:11
normsu[118]$ ruby -v
ruby 1.6.7 (2002-03-01) [i686-cygwin]

Thanks,

--
Norman Makoto Su



Tue, 09 Nov 2004 11:03:29 GMT  
 pstoring a tkvariable
Hi,


Subject: pstoring a tkvariable
Date: Fri, 24 May 2002 11:57:43 +0900

Quote:
> This is probably due to some internal working with TkVariables, but can
> someone enlighten me as to why this won't work?

A TkVariable instance is an accessor for a variable on the
Tcl interpreter. When a TkVariable instance is generated,
Ruby/Tk defines a variable on the Tcl interpreter.
PStore can treat the TkVariable object on Ruby,
but cannot treat the variable on the Tcl interpreter.
( By the similar reason, PStore cannot treat Tk widgets. )
Can you understand the reason of your problem by this explanation?
--



Tue, 09 Nov 2004 12:32:02 GMT  
 pstoring a tkvariable

Quote:
> PStore can treat the TkVariable object on Ruby,
> but cannot treat the variable on the Tcl interpreter.
> ( By the similar reason, PStore cannot treat Tk widgets. )
> Can you understand the reason of your problem by this explanation?

Yup, understood.  Thanks for clearing things up for me.

--
Norman



Fri, 12 Nov 2004 09:05:59 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. TkVariable

 

 
Powered by phpBB® Forum Software