Guidance
指路人
g.yi.org
Guidance Forums / wxWidgets (wxWindows) in C++ / wxNoteBook and panels

Register 
新用户注册
Search 搜索
首页 
Home Home
Software
Upload

  
Forum List • Thread List • Refresh • New Topic • Search • Previous • Next First 1 Last
Message1. wxNoteBook and panels
#3753
Posted by: 2004-04-06 17:35:56
Hi,

I'm using a frame in wich I added a notebook with a panel inside it.
I'm using wxGlade but it shouldn't cause any problem ...

I want to add some buttons inside the panel so I added a sizer to contain them but my problem is that all the buttons are spreaded over the panel surface.

I just want them to fit their minimal sizes and to be aligned at the top-left corner of the panel. And I don't see how to do that.


Steph
Message2. Re: wxNoteBook and panels
#3767
Posted by: 2004-04-08 18:35:16
hi,

don't know wxGlade, is it of 2.5, and what's it for?
Have you tried, placing the buttons "manually", without sizer:

wxPoint posB1(20, 20);
wxButton *p_button = new wxButton(panel, ID, "button", posB1, wxDefaultSize, wxBU_EXACTFIT, wxDefaultValidator, "name");

the style wxBU_EXACTFIT causes the minimal size.
Don't know mutch about sizers, managed it my own by getting the size ( x and y) of the former items while storing it to a added memberdata of a derived class (e.g. MyTxtCtrl) and request them before generating the next item (addind the space between the two items)

Did you think of what will happen, if the frame's size would change?
I got this problem before and solved it by using wxScrolledWindow instead of wxPanel...

Hope it helps...
Regards
Achim
Message3. Re: wxNoteBook and panels
#3774
Posted by: 2004-04-09 00:39:23
Thanks for your answer, I'll investigate this way ...

wxGlage is a free gui builder wich can generate c++ files.

Regards,
Steph
Message4. Re: wxNoteBook and panels
#3805
Posted by: 2004-04-12 06:44:43
Well, I have to say that sizers it is one of the best things in wxWidgets, although I didn't know how to use it on the beginning and I had a lot of problems with it. You can do this like that

sizer->Add(button, 0, wxALL, 10);

There is a very good tutorial about using sizers in the wxWidgets documentation. I recommend You to learn about sizers and you work with wxWidgets will be much more easier in the future. In the example above the sizer will not resize button horizontally or vertically but will put it with the 10 pixels border around the button. rem.
Message5. Re: wxNoteBook and panels
#3813
Posted by: 2004-04-12 23:34:49
Thanks for your answer ... Actually I'm trying to learn more about using the sizers.

There's also a tutorial (general wxWidgets programming) here
http://users.skynet.be/saw/wxWindows.htm

Steph
Forum List • Thread List • Refresh • New Topic • Search • Previous • Next First 1 Last
掌柜推荐
 
 
 
 
 
 
 
 
 
 
 
 
© Tue 2021-9-21  Guidance Laboratory Inc.
Email:webmaster1g.yi.org Hits:0