Re: How does one overlay one image on top of another ?



Hi Gregory,

Step 3 (where you put the 1st GtkFixed into the GtkVBox) - You specify that you "position" it in teh "upper left" corner. GtkVBox doesn't let you position it's children, and GtkFixed doesn't let you position itself (only it's children). So I'm wondering about your
statement of "put it at the upper left of the GtkVBox"

I was writing that from memory, and clearly remembered it wrong. It should have been that I added the GtkFixed to the the GtkVBox, and then added the GtkImage to that so it was positioned at the upper left corner of the screen.

Step 4) The 2nd GtkFixed is a child of which ? the GtkVBox, or the 1st GtkFixed. It seems to me that the only way to position the 2nd GtkFixed, is to make it a child of the 1st
GtkFixed. Is this what you did ?

My recollection on this is wrong, too. Upon reviewing the documentation, I'm pretty sure I only used one GtkFixed and put both GtkImages into it at different positions. I may have even omitted the GtkVBox, and just put one GtkFixed into the window.


Other than that, this looks pretty much like what I'm looking for. When I want to move the embedded image, I just gtk_fixed_move the embedded image within the 1st GtkFixed. In fact... it looks to me like I do not need the 2nd GtkImage embedded inside of a GtkFixed, since (as near as I can tell from reading the GtkFixed documentation), positioning the embedded image will be done by gtk_fixed_move() of the child inside the top layer
GtkFixed. Do you concur ?

I strongly suggest you experiment with this.

Here's what I hear you saying:
1. Make a window, and put some kind of container (GtkVBox/GtkHBox) in it.
2. Make a GtkFixed, put that in the container, and put the first GtkImage inside it.
3. Make a second GtkImage and put it in the container, too.
4. When you want, move the first GtkImage around with gtk_fixed_move().


If that's correct, I doubt it will work. The GtkFixed from step 2 and the GtkImage from step 3 are peers, and won't overlap. The GtkFixed will try to set its size to accommodate its children, and second (non-child) GtkImage (or any other peer widgets) will try to move out of its way.

In fact, I just reviewed the GtkFixed sources. When you do a gtk_fixed_move() on the child GtkImage, that triggers a size renegotiation, and the non-child GtkImage will keep moving out of its way. So you won't be able to make the two GtkImages overlap by moving one of them around.

So if you want overlap, you would probably do better to put both GtkImages inside the same GtkFixed. Then you can move them around and force them to overlap.

- Bob




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