Christian Surlykke
3/25/2007 6:51:00 PM
Hi
Still trying to call Tk::Tile::Dialog#client_frame and still having problems.
Resumé:
When I do:
Tk::TIle::Dialog.new(type=>'okcancel').client_frame
I get:
/usr/local/lib/ruby/1.8/tk.rb:1694:in `_invoke_without_enc': wrong # args:
should be "::ttk::dialog::clientframe dlg" (RuntimeError)
from /usr/local/lib/ruby/1.8/tk.rb:1694:in `_ip_invoke_core'
from /usr/local/lib/ruby/1.8/tk.rb:1730:in `_tk_call_core'
from /usr/local/lib/ruby/1.8/tk.rb:1758:in `tk_call_without_enc'
from /usr/local/lib/ruby/1.8/tkextlib/tile/dialog.rb:54:in
`client_frame'
from ./dialogtst.rb:36
I thought I had it figured out from looking at
Tk::Tile::TNotebook#enable_traversal
That method calls
tk_call_without_enc('::ttk::notebook::enableTraversal', @path)
- so I redefined Tk::Tile::Dialog#client_frame as:
class Tk::Tile::Dialog
def client_frame
window(tk_call_without_enc('::ttk::dialog::clientframe', @path))
end
end
and do:
Dialog.new(:type=>'okcancel').clientframe
- but then I get:
/usr/local/lib/ruby/1.8/tk.rb:1694:in `_invoke_without_enc': bad window path
name ".w00000.f" (RuntimeError)
from /usr/local/lib/ruby/1.8/tk.rb:1694:in `_ip_invoke_core'
from /usr/local/lib/ruby/1.8/tk.rb:1730:in `_tk_call_core'
from /usr/local/lib/ruby/1.8/tk.rb:1758:in `tk_call_without_enc'
from ./dialogtst.rb:32:in `client_frame'
from ./dialogtst.rb:37
Now, I know that the path of the dialog must be '.w00000', so somewhere '.f'
is appended. Does anybody know where an why?
My appologies for persisting with this question, by I'm really stuck.
br. Christian Surlykke
Onsdag den 21. Marts 2007 skrev Christian Surlykke:
> Hi
>
> I'm trying to write a gui program using Ruby and Tk/Tile.
>
> I'd like to do something like:
>
> require 'tk'
> require 'tkextlib/tile'
>
> d = Tk::Tile::Dialog.new(:type=>'okcancel', :message=>'Enter name:')
> Tk::Tile::Entry.new(d.client_frame).pack
> d.show
>
> - but I get:
>
> RuntimeError: wrong # args: should be "::ttk::dialog::clientframe dlg"
> from /usr/local/lib/ruby/1.8/tk.rb:1694:in `_invoke_without_enc'
> from /usr/local/lib/ruby/1.8/tk.rb:1694:in `_ip_invoke_core'
> from /usr/local/lib/ruby/1.8/tk.rb:1730:in `_tk_call_core'
> from /usr/local/lib/ruby/1.8/tk.rb:1758:in `tk_call_without_enc'
> from /usr/local/lib/ruby/1.8/tkextlib/tile/dialog.rb:54:in
> `client_frame'
>
> It seems that Tk::Tile::Dialog#client_frame launches an incorrect command
> against tcl.
>
> It works at the Tcl/Tk level. This script (which I've constructed with a
> considerable effort, as I don't speak tcl):
>
> package require tile
> ttk::dialog .dlg -type okcancel -message "Enter name:"
> set cf [ttk::dialog::clientframe .dlg]
> ttk::entry $cf.entry
> pack $cf.entry
>
> does what I want. (Sorry for posting tcl on this list :-))
>
> Could it be a version problem?
> I'm running ruby 1.8.6, Tcl8.5a5, Tk8.5a5, Tile-0.7.8. All compiled from
> sources on a debian unstable box.
>
>
> br. Christian Surlykke