Re: Newbie questions - Frames



"Aubury, Mike" wrote:
> I'm using a GtkFixed container to house a few GtkFrames (this is a
> requirement - I have to use co-ordinate placing).
> 
> When the frames overlap - they don't draw the borders I expect (using any of
> the styles I've tried)
> 
> (Ascii art - set font to courier!)
> 
> Using a couple of  frames for an example
> 
> This is what I'd expect :
> 
> Frame 2 on top
> +---------+
> | 1       |
> |   +--------+
> |   | 2      |
> +---|        |
>     +--------+
> 
>  Frame 1 on top
> 
> +---------+
> | 1       |
> |         |--+
> |         |  |
> +---------+  |
>     +--------+
> 
> This is what appears when frame 2 is on top
> +---------+
> | 1       |
> |         +--+
> |     2      |
> +---+        |
>     +--------+
> 
> And when frame 1 is on top
> +---------+
> | 1       |
> |         +--+
> |            |
> +---+        |
>     +--------+
> 
> Is there anyway of correcting this ?

GTK doesn't really support overlapping widgets unfortunately. Frames
don't have their own windows, they draw directly on to their parent
(this is for efficiency reasons, many gtk widgets work like this). When
frame 2 draws, it doesn't know that it should be under frame 1, so you
get horrible clashes.

I fudge something rather like this in my app by wrapping each frame in
an event box. This forces the frames into their own windows, and X then
does the clipping magic to get overlapping to work correctly. You can
even change the stacking order by fiddling with the container widget a
bit :-) but that really is unsupported.

Here's a screen shot of my app, showing the little subwindows:

	http://www.vips.ecs.soton.ac.uk/shot.jpg

There's some code you can steal if you like: download vips-7.7.6, look
at vips-7.7.6/contrib/ip/src_gtk2/columnview.c

I use GtkLayout rather than GtkFixed (I think it handles scrolling
better, not sure).




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