GTK ListBox?

L

Len Lawrence

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.
 
C

Clifford Heath

Len said:
... 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 Heath.
 
L

Len Lawrence

----- 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
 
L

Len Lawrence

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,770
Messages
2,569,588
Members
45,094
Latest member
PollyBlau4

Latest Threads

Top