Problem with Tk::Tile::Dialog#client_frame

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:intk_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 S.

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:intk_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:intk_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 S.

Onsdag den 21. Marts 2007 skrev Christian S.:

From: Christian S. [email protected]
Subject: Re: Problem with Tk::Tile::Dialog#client_frame
Date: Mon, 26 Mar 2007 03:51:19 +0900
Message-ID: [email protected]

Still trying to call Tk::Tile::Dialog#client_frame and still having problems.
(snip)

  • 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

The real widget of Tk::Tile::Dialog is generated
when “show” method is called.
Before that, “client_frame” method returns an invalid widget path.

It is the specificaion of the widget.
But, I can understand that it is inconvenient.
I’ll consider better ways.