Re: Wrapping gtk2:buttons

On Wed, 2009-06-10 at 15:07 +1000, Chris Debenham wrote:
I need to display 40 buttons in an area which may be resized and the
text in the buttons is dynamic.
As such I can't really determine ahead of time how many buttons will
fit on a row.
Is there any way to display a bunch of Gtk2::Button widgets and have
it wrap around to fit the available space?

I do mean this in a caring way, but that sounds like a *horrible* user
interface :-)

Someone else may have alternate suggestions, but I can think of a couple
of ways to achieve what you're asking for.

* the Gtk::TextView widget is normally used to display word-wrapped
  text but you can add widgets (like buttons) into the textview using
  the add_child_at_anchor() method

* the Gtk::Layout can be used to position widgets at absolute
  coordinates, so by hooking into signals when the window is resized,
  you could adjust the position of the button widgets to reflow them
  as required

I think the Gtk::IconView widget does the kind of layout flowing you're
talking about, but I'm not sure it can be coerced into displaying

I do wonder though whether that many options would be better implemented
as menus rather than buttons.

Good luck

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]