[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

tkextlib and Unicode

Axel

7/3/2005 10:07:00 AM

Hello!

I need to quickly decide if a medium-sized application can be converted
to Ruby. This application has a very sophisticated GUI and needs
extensive Unicode support. As far as I know, the only Ruby GUI library
that supports Unicode is Ruby/Tk. But ... I would also need to use at
least some of the Tk extensions. I'm on Windows XP with the OneClick
Ruby installer 1.8.2-15. I installed ActiveTcl as described in other
posts in this group and edited lib/ruby/1.8/tkextlib/setup.rb to
contain

Tk::AUTO_PATH.list <<= 'c:/tcl/lib'

so at least the BWidgets can be accessed.

Now I tried this code (sorry for mixing various coding stlyes - I was
in a hurry):

require 'tk'
require 'tkextlib/bwidget/combobox.rb'
root = TkRoot.new { title 'Test' }
cb = Tk::BWidget::ComboBox.new(root)
txt = Tk::UTF8_String('\u00E4\u03B1')
cb.configure('values', [txt])
cb.pack
t = TkText.new.pack
t.insert('end', txt);
t.pack
l = TkLabel.new(root) {
text txt
}
l.pack
Tk.mainloop

I get the correct "text" in the text area and the label. But the combo
box seems to show me the raw UTF-8 bytes. Any fix for that? I tried it
various versions of ActiveTcl (8.3, 8.4, 8.5), always with the same
result. But as Tk_VERSION is 8.3 on my system, it's possible that newer
extensions don't get used (as at least ActiveTcl 8.5 seems to install
multiple versions of its components).

Kind regards, ---------------- Axel <><

4 Answers

Hidetoshi NAGAI

7/3/2005 1:43:00 PM

0

Hidetoshi NAGAI

7/3/2005 2:17:00 PM

0

Hidetoshi NAGAI

7/3/2005 2:22:00 PM

0

Axel

7/4/2005 8:16:00 AM

0

Hello, Nagai-san!

You are right, adding

$KCODE = 'u'

before requiring Tk also fixes the problem. Thank you very much!