[#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:04240] Re: Gtk Wins and scrolls

From: Aleksi Niemel<aleksi.niemela@...>
Date: 2000-07-27 18:48:51 UTC
List: ruby-talk #4240
> >   Ruby/GTK works with Ruby 1.4.x and GTK+ 1.2.x. 
> > If this is the case, when can we expect an update for Gtk-cygwin?
> 
> as you are saying above, current version of ruby/gtk is only for gtk
> 1.2.  patch is always welcome, i suppose :)

Thanks for the confirmation. I think I'm not good enough to start moving
Ruby/gtk to match Gtk version 1.3. But I wonder if someone would be kind
enough to provide right, working set of dlls. Maybe they could be even set
up to the Ruby-gtk homepage for download with cygwin-version.

> 
> > 2)
> > I'm really newbie with gtk so enlight me. How should I 
> scroll a window
> > containing text box to certain location?
> 
> do you want to scroll a window? or you want to move cursor position in
> the text widget?
> 
> i'm attaching an example for scrolling a window widget.  let me know
> if you just want to move the cursor. :)

Thanks for the example. This was the trick:
>   adj = sw.get_vadjustment
>   adj.value = adj.upper

I browsed the sources for a while to find out how to use adjustments, but I
didn't understand I should actually use the returned vadjustment. I was
trying to find a way to say sw.set_vadjustment(Adjustment.new)...

Anyway, yesterday I twisted my code very briefly but I didn't understood
what are the values for upper and lower. They didn't seem to have any
relationship to the bytes of the buffer or the line count (line count /
(upper-lower) was not integer).

Haa, now I browsed some web and found next paragraph from
http://www.gtk.org/tutorial/gtk_tut-7.html

  The other group includes the text widget, the viewport widget, 
  the compound list widget, and the scrolled window widget. All 
  of these widgets use pixel values for their adjustments. These 
  are also all widgets which are typically "adjusted" indirectly 
  using scrollbars. While all widgets which use adjustments can 
  either create their own adjustments or use ones you supply, 
  you'll generally want to let this particular category of widgets 
  create its own adjustments. Usually, they will eventually 
  override all the values except the value itself in whatever 
  adjustments you give them, but the results are, in general, 
  undefined (meaning, you'll have to read the source code to 
  find out, and it may be different from widget to widget). 

So I guess I'm a little bit out of luck here. If I want to scroll a text
widget to show certain text it will be about impossible? Maybe I should to
try to estimate the "right" value for the adjustment, let's see where I end
up... 

If someone knows something about this already, I'd be grateful.

	- Aleksi

In This Thread

Prev Next