From: Kevin Smith Date: 2000-12-23T16:33:47+09:00 Subject: [ruby-talk:7996] I ported my app from Tk to GTK Well, porting my little app from Tk to GTK took about three hours. No major problems, and all-in- all the app is slightly more attractive and well- behaved. Here are the gotchas I encountered (of course, one or more of them may be my own misunderstandings): 1. Gtk::CList does not seem to have a "get selected" method, nor a "size" method like Tk. So I had to catch the select and unselect events and remember the current item for myself. And I had to keep track of the row count myself, also. It seems like I must just be missing something. 2. Based on the C API, I was expecting to find a method named CList#remove but it is actually CList#remove_row. 3. The default size for the Text widget is really small. So I have to create default sizes for my outer windows to make it reasonable. 4. Widget creation is a bit different. In Tk, you specify the parent as part of the .new call. With GTK, you create the widget, and later tell the parent to add the widget to itself. And the stuff where GTK really helped me out: 1. GTK does not require the distinction between root and toplevel. 2. GTK has a really cool multi-column listbox. Really, really cool. 3. GTK has a ScrolledWindow class that is great for quickly and painlessly adding scrollbars to text boxes and list boxes. I think that's it. The code seems cleaner to me. Perhaps it's just because GTK uses a paradigm that's closer to other GUI systems I've used in the past. The available C documentation also seems to map more directly to Ruby/GTK than the Perl/Tk documentation did to Ruby/Tk. Kevin