[#3986] Re: Principle of least effort -- another Ruby virtue. — Andrew Hunt <andy@...>

> Principle of Least Effort.

14 messages 2000/07/14

[#4043] What are you using Ruby for? — Dave Thomas <Dave@...>

16 messages 2000/07/16

[#4139] Facilitating Ruby self-propagation with the rig-it autopolymorph application. — Conrad Schneiker <schneik@...>

Hi,

11 messages 2000/07/20

[ruby-talk:04208] Gtk Wins and scrolls

From: Aleksi Niemel<aleksi.niemela@...>
Date: 2000-07-25 11:18:18 UTC
List: ruby-talk #4208
Two questions about Gtk, both probably quite simple:

1)
How one can get Gtk work on Win? Could someone confirm it's working well and
briefly explain the setup?

I downloaded newest gimp (http://user.sgic.fi/~tml/gimp/win32/downloads.html
points to http://www.gimp.org/win32/gimp-setup-20000416.zip), and Ruby
extension Gtk-cygwin
(ftp://ftp.netlab.co.jp/pub/lang/ruby/pc/ruby-gtk-0.23-cygwin.zip).

I've tried every possible combination how files could arranged and the best
try, I guess, was when Ruby said:

ruby -v
ruby 1.4.5 (2000-06-26) [i386-cygwin]

ruby -Idlls -e'require "gtk"'
LoadLibraryExA: gtk.dll
C:\DOCUME~1\niemela\LOCALS~1\Temp/rb001000:1:in `require': 1114: A dynamic
link library (DLL) initialization routine failed.   - ./gtk.dll (LoadError)
        from C:\DOCUME~1\niemela\LOCALS~1\Temp/rb001000:1

This clearly indicates that at least the gtk.dll has been found, ruby is
just unable to initialize it properly for use.

I have the following dlls in the directory specified with -I:

2000-04-16  09:19              395 952 gdk-1.3.dll
2000-03-11  11:32              134 266 gdk_imlib.dll
2000-04-11  21:20               72 192 gimp-1.1.dll
2000-04-11  21:20              125 440 gimpui-1.1.dll
2000-03-26  21:54              208 017 glib-1.3.dll
2000-03-26  21:54               16 884 gmodule-1.3.dll
1999-11-14  02:48               28 405 gnu-intl.dll
2000-03-26  21:54               23 000 gthread-1.3.dll
2000-04-15  08:17            1 438 262 gtk-1.3.dll
2000-03-20  23:26               79 872 gtk.dll
2000-03-11  11:32              132 569 imlib-jpeg.dll
2000-03-11  11:32              145 041 imlib-png.dll
2000-03-11  11:32              413 808 imlib-tiff.dll
1999-06-21  00:10               36 924 pthread.dll

As you can see the gnu-intl.dll and pthread.dll are older than the others,
but it seems to be unimportant.

So I'm asking if you could kindly help me out here.

I suspect the problem is in rather old ruby-gtk-0.23-cygwin, because the
date on the list for it seems to be 2000-03-20 while the gtk-1.3 has been
compiled at 2000-04-15. Could that be the reason?

Actually I'm even more suspicious the problem is about version
incompatibility because http://www.ruby-lang.org/gtk/en/index.html says:

  Ruby/GTK works with Ruby 1.4.x and GTK+ 1.2.x. 

So perhaps the dll load should fail, as the GTK shipped with Windows
installation kit for GIMP seems to be the version 1.3 instead of 1.2.

If this is the case, when can we expect an update for Gtk-cygwin?

2)
I'm really newbie with gtk so enlight me. How should I scroll a window
containing text box to certain location?

Here's a setup:

    w = Gtk::ScrolledWindow.new(nil, nil)
    w.set_policy(Gtk::POLICY_NEVER, Gtk::POLICY_ALWAYS)
    w.set_usize(400,600)
    box.pack_start(w, true, true, 0)
    w.show
    
    text = Gtk::Text.new(nil, nil)
    text.set_editable(false)
    w.add(text)
    text.show

And here's the reposition:

    # 2DO: there has to be better way!!!
    text.thaw                           # 1
    text.set_point(start)                 # 2
    text.insert(nil, nil, nil, "a")         # 3
    text.set_point(start)                   # 3
    text.forward_delete(1)                  # 3

Some notes:

# 1  Wont reposition if the textbox is freezed
# 2  Does not do the trick alone, but requires # 3
# 3  Only really inserting something scrolls the window.

Even with this trick the scroll is extremely slow (I guess the window is
redrawed for each row scrolled).

I guessed vadjustment for scrollwindow might do the trick, but couldn't make
it happen.

	- Aleksi

In This Thread

Prev Next