Re: new to gtk, how can I limit widgets?



On Sat, 2007-03-17 at 18:35 -0700, ian baber wrote:
Unfortunately, the GtkWidget methods don't seem too help.  the usize  
methods have been deprecated in favor of size_request, which only  
changes the amount of space requested for the widget during the size  
allocation, it will be changed to allow for the widgets inside the  
container.

I can't use a scrolled window because I need multiple areas in the  
window.  And even if the widget is too big, I DONT want scroll bars  
because the take up space.  This interface is meant to be seen, never  
actually interacted with (weird kiosk like application), so if a  
widget is broken, the goal is just to keep it from breaking the over  
all interface or other widgets.

I think what I want may be a GtkScrolledWindow, only without the  
scroll bars.  Is there a way to mimic its functionality, and leave  
out the scroll bars?

Of course.  The GtkScrolledWindow widget can bet set so that the
scrollbars are always on, always off, or automatically shown.

One possible solution is to use the GtkScrolledWindow with the
scrollbars configured not to show, the size set to the minimum proper
size, and then when you pack the widget into a layout, tell it to
"expand" but not "fill."  This way the window has a minimum size, but if
the window is expanded, the plugin widgets will still show properly,
albeit with a bit of whitespace around them.

Michael



On Mar 17, 2007, at 6:11 PM, Michael Torrie wrote:

On Sat, 2007-03-17 at 17:12 -0700, ian baber wrote:
I'm working on a project using the GTK2 perl package, and I need a
way to set absolute limits on a container widget.  The program needs
to be able to divide up the screen using several containers, and then
hand each of those off to a plugin.  The problem is that I want the
containers to ALWAYS remain the same size, regardless of how much or
how little the plugin puts in it.  If the children widgets won't fit,
they should be truncated/cut off at the edge.

Basically, you can constrain a widget size, yes.  Check the GtkWidget
methods.  I am not sure, but it might be a call with "usize" in the
name.  I know in Glade I can simply set it in the XML.  What I'd do  
if I
were you would be to use a scrolled window that's the absolute, fixed
size.  That way if the plugin's widgets were too big, at least it  
would
scroll around a bit.

Michael



Is there a way to do this in GTK?
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list







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