[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]
Re: Wrapping gtk2:buttons
- From: Chris Debenham <chris adebenham com>
- To: Grant McLean <grant mclean net nz>
- Cc: gtk-perl-list gnome org
- Subject: Re: Wrapping gtk2:buttons
- Date: Wed, 10 Jun 2009 19:51:43 +1000
2009/6/10 Grant McLean <grant mclean net nz>:
> 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 :-)
No worries, Normally I'd agree but it does make sense for this
particular use case.
It is to display a list of bible books as buttons - these buttons are
then replaced with buttons for the chapters, then verses.
It is used for quickly looking up verses (without having to type) See
http://www.adebenham.com/lyricue/screenshot.html for a screenshot
showing part of it
>
> 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
Ugly - but may work
>
> * 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
This would get complicated/slow as it has to be done for up to 150
buttons (for chapters with lots of verses)
>
> 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
> buttons.
I found a reference to how iconview implements CellLayout so a custom
CellRenderer should be possible - If I can control the sizing this is
probably the best way
>
> I do wonder though whether that many options would be better implemented
> as menus rather than buttons.
Normally yes - but not in this context
>
> Good luck
> Grant
Thanks for the pointers - now I just have to go and try them out :-)
>
> _______________________________________________
> gtk-perl-list mailing list
> gtk-perl-list gnome org
> http://mail.gnome.org/mailman/listinfo/gtk-perl-list
>
--
Dave Barry - "Camping is nature's way of promoting the motel
business." - http://www.brainyquote.com/quotes/authors/d/dave_barry.html
[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]