GTK ListBox?

Greetings Ruby gurus

I have recently started using ruby (cool!) and have written a couple of
simple programs with Ruby/Tk interfaces. They work fine but I have been
unable to access Tk without using a barrow load of global variables,
which
goes against the grain. Ruby/GTK allows encapsulation of the gui within
a
class which is what I want but I am having difficulties with gtk2, also
a
new area for me. There does not seem to be a ListBox widget,
specifically a
scrolling listbox. This is a fundamental type of widget I would have
thought; it is not mentioned in any of the documentation that is
available
from standard sources and using strings and grep on gtk2.so returns
nothing for listbox. Googling does not return anything useful except to
indicate that most other gui toolkits have something of the kind. I do
not know enough about ruby or GTK to attempt coding a listbox myself so
does anybody know where in the ruby domain such a thing may be found?

Apologies for the fact that this is not a coding question. If I cannot
find a listbox implementation I shall have to abandon GTK, which I
prefer
because I work under GNOME. wxWidgets installed but resisted all
attempts
to run it.

Len L. wrote:

… I am having difficulties with gtk2, also a
new area for me. There does not seem to be a ListBox widget

Nearly everything about Gtk is hard - debugging esp - but…

For a simple list or table you use TreeView with a ListStore.

If you’re looking for a non-editable equivalent to Windows’
ComboBox, consider using an OptionMenu. That’s the X equivalent,
which is where Gtk takes its inspiration. Or construct a
composite widget using a text box, an arrow button, and a
drop-down containing a scrolling TreeView (whew).

Clifford H…

On Mon, 01 Oct 2007 15:18:26 +1000, Clifford H. wrote:

----- snip ------
For a simple list or table you use TreeView with a ListStore.

If you’re looking for a non-editable equivalent to Windows’
ComboBox, consider using an OptionMenu. That’s the X equivalent,
which is where Gtk takes its inspiration. Or construct a
composite widget using a text box, an arrow button, and a
drop-down containing a scrolling TreeView (whew).

Yes, I noted TreeView and ListStore but that seemed too complicated for
such a basic operation as list and select (optional). Thanks for the
suggestion.

I suspect that it will have to be Tk in the end - 15 years of
experience.
Just need to figure out why encapsulation does not work. Examples from
documentation (Pickaxe?) do not work as published.

Len

On Mon, 01 Oct 2007 06:52:11 +0000, Len L. wrote:

----- snipped again ------

Apologies for answering my own post. Had another go with wxWidgets.
Installed the ruby gem and copied the installed files to the site_ruby
directory. All is well - and wxRuby has a listbox. This might help
somebody as green as me.

Len

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs