Trouble with panels that overlap Topic is solved

If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
Post Reply
forrestcupp
Earned some good credits
Earned some good credits
Posts: 102
Joined: Thu Dec 28, 2006 5:12 pm
Location: Indiana, US

Trouble with panels that overlap

Post by forrestcupp »

In my window, I have a small panel that is 200x200. In that panel is a static text. I also have another panel the same size that partially overlaps the first panel.

The problem is that the static text portion of the lower panel shows through the panel on top. Is there any way to get the top panel to overlap even the static text in the lower panel? I don't want to just set the text's Show to false because I'd like to be able to see the portion that isn't overlapped.
Auria
Site Admin
Site Admin
Posts: 6695
Joined: Thu Sep 28, 2006 12:23 am
Contact:

Post by Auria »

wxWidgets does not support overlapping; can you describe what you want to do? There's probably a better way
"Keyboard not detected. Press F1 to continue"
-- Windows
forrestcupp
Earned some good credits
Earned some good credits
Posts: 102
Joined: Thu Dec 28, 2006 5:12 pm
Location: Indiana, US

Post by forrestcupp »

I'm using a raised border panel for the front of a flash card that has numbers on it. I'm using another raised border panel with a different background color for the backside of another card. That panel/card covers over most, but not all, of the other card with numbers on it.

It works just fine when there is no static text on the first panel. But as soon as I add static text (the numbers) to that panel, they show through the panel that represents the top card. Not everything shows through, only the section that contains the static text.

I don't want to get crazy with drawing things; I'm just wanting to keep this simple. If there's no way to do it, I can change my implementation.
Auria
Site Admin
Site Admin
Posts: 6695
Joined: Thu Sep 28, 2006 12:23 am
Contact:

Post by Auria »

Is this meant to be a card game, like solitaire? In this case I would very strongly recommend drawing, it will be easier for you in the end this way. If not, then I didn't get it, sorry :lol:
"Keyboard not detected. Press F1 to continue"
-- Windows
forrestcupp
Earned some good credits
Earned some good credits
Posts: 102
Joined: Thu Dec 28, 2006 5:12 pm
Location: Indiana, US

Post by forrestcupp »

It's meant to be an addition flash card app that I wanted to quickly throw together for my son.

I know I can accomplish that by drawing, but I just wanted to do something quick and easy. If I can't do it that way, I'll just take other measures, or make it less complicated.

Thanks.
yuri
Earned some good credits
Earned some good credits
Posts: 104
Joined: Thu Apr 09, 2009 4:58 pm
Location: Russia

Post by yuri »

Did you try setting wxPanel style bit 'wxCLIP_CHILDREN'?
forrestcupp
Earned some good credits
Earned some good credits
Posts: 102
Joined: Thu Dec 28, 2006 5:12 pm
Location: Indiana, US

Post by forrestcupp »

That's interesting. I just tried what you said, but it didn't work.

I have panel2 as the lower panel with the static text. panel3 is the panel that I want to partially cover panel2. I set the wxCLIP_CHILDREN bit in panel2, but that didn't do the trick.

Is that what I was supposed to do?
yuri
Earned some good credits
Earned some good credits
Posts: 104
Joined: Thu Apr 09, 2009 4:58 pm
Location: Russia

Post by yuri »

forrestcupp wrote: I set the wxCLIP_CHILDREN bit in panel2, but that didn't do the trick.

Is that what I was supposed to do?

I've tried to reproduce what you said, in wxGTK2.8.9. It works without any extra bits and settings, see attached image. Both texts are larger than parent pane and both are clipped. If you want I can post XRC for this.

Actually each of two panels and texts are (should be) different windows and painting over one window being child of another is technically tricky!

could it be that you created wxStaticText as child of top level pane and not child of panel2 ?
Attachments
panels.png
panels.png (3.2 KiB) Viewed 2264 times
forrestcupp
Earned some good credits
Earned some good credits
Posts: 102
Joined: Thu Dec 28, 2006 5:12 pm
Location: Indiana, US

Post by forrestcupp »

No. The static text's parent is panel2.

It must be something that just works in GTK but not Windows Vista. Can you post your code for that part?
yuri
Earned some good credits
Earned some good credits
Posts: 104
Joined: Thu Apr 09, 2009 4:58 pm
Location: Russia

Post by yuri »

Attached is XRC file that I was using, with extension changed to TXT to fit forum rules. No special code was involved. I can't check it in Vista :(
Attachments
album.txt
(1.07 KiB) Downloaded 76 times
forrestcupp
Earned some good credits
Earned some good credits
Posts: 102
Joined: Thu Dec 28, 2006 5:12 pm
Location: Indiana, US

Post by forrestcupp »

It appears that you must use some kind of form builder or GUI designer. I'm doing all of my own coding, so that file didn't really help me. Could you upload your cpp file?
forrestcupp
Earned some good credits
Earned some good credits
Posts: 102
Joined: Thu Dec 28, 2006 5:12 pm
Location: Indiana, US

Post by forrestcupp »

Auria wrote:Is this meant to be a card game, like solitaire? In this case I would very strongly recommend drawing, it will be easier for you in the end this way. If not, then I didn't get it, sorry :lol:
Well, it didn't really solve my problem, but it's what I ended up having to do.

I wanted to quickly throw this thing together, but I ended up putting a lot more into it than I intended to. I went with drawing for a lot of things.

I guess it's better to do things right.
Post Reply