Guidance Forums / wxWidgets (wxWindows) in C++ / panels and sizers

Search 搜索
Home Home

Forum List • Thread List • Reply • Refresh • New Topic • Search • Previous • Next First 1 Last
Message1. panels and sizers
Posted by: lea 2003-11-20 14:16:16

Next question!
I tried to implement a wxFrame with a panel.
Doesn't seem to work like in Java, panel seems to be something else.

wxFrame has a sizer, the sizer has a panel.
It does not show anything, but when i put the panel out of the sizer it works.

Lets say it have two panels, and one wxFrame, how should i add the panels to a sizer, which i can set for the wxFrame?
Very confusing, found nothing in the whole net...

Message2. Re: panels and sizers
Posted by: upCASE 2003-11-20 17:35:38
Try it by using wxGlade and after playing around with it it will be quite obvious :)

Seriously: A panel is nothing more then a blank space where you can put you controls on or draw on it.
If you have a wxFrame and show it, there will be a dark gray area, meaning it is blank. Adding a  wxPanel to that frame will make the client area show a light gray area. This is your panel coloured with the default system colour.

If you want to add two panles to a sizer/frame, set a box sizer for the frame and add both panels to it.

If it was hard to write, it should be hard to read!- Do. Or do not. There is no try!
Message3. Re: panels and sizers
Posted by: lea 2003-11-20 23:19:58

The problem was,  i did not set the size hints for the panel and did not set wxEXPAND, too.
So the panel was from 0,0,0,0 :(.

But works now as expected:).
Forum List • Thread List • Reply • Refresh • New Topic • Search • Previous • Next First 1 Last
© Tue 2024-7-23  Guidance Laboratory Inc. Hits:0