Guidance
指路人
g.yi.org
Guidance Forums / wxWidgets (wxWindows) in C++ / Two questions

Register 
注册
Search 搜索
首页 
Home Home
Software
Upload

  
Forum List • Thread List • Reply • Refresh • New Topic • Search • Previous • Next First 1 Last
Message1. Two questions
#4899
Posted by: matze 2004-07-26 04:04:26
1. Is there a way to add an image to a sizer? I emulate this with a bitmapbutton and wxNO_3D but don't find this very convenient.

2. Is it possible to have an expanded staticline next to static text inside a horizontal box sizer? I tried several hours to implement something like this: "sometext -------" but I only see the text.
Message2. Re: Two questions
#4905
Posted by: upCASE 2004-07-29 03:26:24
Hi!
1. Try with a wxStaticBitmap.
2. The magic thing is setting the correct proportion.
Although the meaning of this parameter is undefined in wxSizer, it is used in wxBoxSizer to indicate if a child of a sizer can change its size in the main orientation of the wxBoxSizer - where 0 stands for not changeable and a value of more than zero is interpreted relative to the value of other children of the same wxBoxSizer. For example, you might have a horizontal wxBoxSizer with three children, two of which are supposed to change their size with the sizer. Then the two stretchable windows would get a value of 1 each to make them grow and shrink equally with the sizer's horizontal dimension.
So in a horizontal sizer add a label with proportion set to 0 and a static line with proportion set to 1. That way the label will have static size, while the static line will grow as you resize the frame.
upCASE
-----------------------------------
If it was hard to write, it should be hard to read!- Do. Or do not. There is no try!
Message3. Re: Two questions
#4907
Posted by: matze 2004-07-29 07:16:19
1. Thanks

2. I actually did that, but the results were quite surprising: http://www.250kb.de/images/20040729/8.jpg

Btw, I wrote a little function to do the annoying work for me, maybe some parameters are off?
[size=2]wxBoxSizer* staticTextLine(wxWindow* parent, wxString label)
{
    wxBoxSizer* sizer = new wxBoxSizer(wxHORIZONTAL);
    sizer->Add(new wxStaticText(parent, -1, label), 0);
    sizer->Add(new wxStaticLine(parent, -1), 1, wxEXPAND | wxALL, 5);
    return sizer;
}

//...

leftSizer->Add(staticTextLine(this, _("Description")), 1, wxEXPAND);
[/size]
Message4. Re: Two questions
#4909
Posted by: upCASE 2004-07-29 15:19:33
Hi!
Add the staticline without wxEXPAND.
upCASE
-----------------------------------
If it was hard to write, it should be hard to read!- Do. Or do not. There is no try!
Message5. Re: Two questions
#4911
Posted by: matze 2004-07-29 19:00:19
Thanks :)
Message6. Re: Two questions
#4912
Posted by: upCASE 2004-07-29 19:43:41
Hi!
Glad it worked :)
Check out wxGlade. It really helps when it comes to working with sizers.

Gru? aus K?ln!
upCASE
-----------------------------------
If it was hard to write, it should be hard to read!- Do. Or do not. There is no try!
Message7. Re: Two questions
#4915
Posted by: matze 2004-07-30 05:51:03
I will definitely check this out!

Gru? aus Guben! ;)
Forum List • Thread List • Reply • Refresh • New Topic • Search • Previous • Next First 1 Last
掌柜推荐
 
 
 
 
 
 
 
 
 
 
 
 
© Tue 2024-4-16  Guidance Laboratory Inc.
Email:webmaster1g.yi.org Hits:0