Bwidgets on Ruby question

Hi everyone,

I'm looking for some help to get a start with the BWidget wrappers in
Ruby.

Some quick background. While looking into using different Tk
extensions with Ruby and I've come across both IWidgets and BWidgets.
They both seem to be installed for me on Windows XP when using the
One-Click Installer and ActiveTcl 8.4. There seems to be a fair amount
of sample Ruby code installed for the IWidget wrappers which give me a
pretty good idea of how they work and ook. Unfortunately, there seems
to be no sample code I can find anywhere for the BWidget wrappers. I'm
curious to try out BWidget on Ruby because the Tcl sample applications
for BWidget installed with ActiveTcl 8.4 looks very nice.

I did manage to come across the following Bwidget code on
comp.lang.ruby, but it doesn't work for me. By 'not work' I mean that
the d.draw method doesn't bring up a dialog box and I can't figure out
why.

···

-------------------------------------
require 'tk'
require 'tkextlib/bwidget'

d = Tk::BWidget::Dialog.new(:relative=>Tk.root, :modal=>:local,
                            :separator=>true, :title=>'Dialog Test',
                            :side=>:bottom, :anchor=>:c,
                            :default=>0, :cancel=>3)

d.add(:text=>'btn0', :command=>proc{d.enddialog('btn0 is pressed')})
d.add(:text=>'btn1', :command=>proc{d.enddialog('btn1 is pressed')})
d.add(:text=>'btn2') # use default cmd => return a string of the index
number
d.add(:text=>'btn3', :command=>proc{d.enddialog('btn3 is pressed')})

p d.current_itemconfiginfo(0)

# f = d.get_frame
d.get_frame{|f|
  TkLabel.new(f, :text=>'Here is a frame of the dialog').pack
  TkLabel.new(f, :text=>'Please lay-out your widgets here.').pack

}

TkButton.new(:text=>'show dialog', :command=>proc{p d.draw}).pack

Tk.mainloop
-------------------------------------

Can anyone give a tip on locating some Bwidget sample code or help me
figure out why the above BWidget code doesn't work.

Thanks,

Mike Thompson

Suggest you visit

    http://www.ruby-lang.org/cgi-bin/cvsweb.cgi/ruby/ext/tk/sample/tkextlib/bwidget/

Regards, Morton

···

On Sep 22, 2006, at 1:15 AM, mpthompson at gmail.com wrote:

Hi everyone,

I'm looking for some help to get a start with the BWidget wrappers in
Ruby.

Some quick background. While looking into using different Tk
extensions with Ruby and I've come across both IWidgets and BWidgets.
They both seem to be installed for me on Windows XP when using the
One-Click Installer and ActiveTcl 8.4. There seems to be a fair amount
of sample Ruby code installed for the IWidget wrappers which give me a
pretty good idea of how they work and ook. Unfortunately, there seems
to be no sample code I can find anywhere for the BWidget wrappers. I'm
curious to try out BWidget on Ruby because the Tcl sample applications
for BWidget installed with ActiveTcl 8.4 looks very nice.

Morton,

Thanks a lot. Exactly what I was looking for. I should have simply
searched my Ruby directory tree rather than try to use Google to find
these on the web.

Mike

Morton Goldberg wrote:

···

Suggest you visit

    http://www.ruby-lang.org/cgi-bin/cvsweb.cgi/ruby/ext/tk/sample/
tkextlib/bwidget/

Regards, Morton