Guidance
指路人
g.yi.org
Guidance Forums / wxWidgets (wxWindows) in C++ / newbie needs help with wxWindows

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

  
Forum List • Thread List • Reply • Refresh • New Topic • Search • Previous • Next First 1 Last
Message1. newbie needs help with wxWindows
#3270
Posted by: 2004-01-25 18:17:58
Hi,

I am totaly newbie so sorry for stupid question ;o)

I need to write something like "commander list of files"- where to each  file exists chceck box to select/deselect it- so I thought this hierarchy should by suitable:

wxFrame1
   -  wxScrolledWindow1
        - wxBoxSizer1
               - wxCheckBox1
               - wxCheckBox2
               - wxCheckBox3
               - wxCheckBox4
               - wxCheckBox5

But there is not possible to:  (pseudocode)
     wxScrolledWindow1->add(wxBoxSizer1,...);

Can anyone help me what should be better hierarchy? Any advice will by very appreciated.

-RB-
Message2. Re: newbie needs help with wxWindows
#3274
Posted by: upCASE 2004-01-27 16:55:18
Hi!
Well, currently I can't think of a reason why your plan should not be suitable :)
I guess the problem why it won't work has nothing to do with the hierarchy, but with the way you planned on implementing it.
Try this:
1. Create a Frame class derived from wxFrame.
2. The frame class has 2 major objects -> 1 x wxScrolledWindow, n x wxCheckbox.
3. Create the objects so that the parent window of wxScrolledWindow is the frame, and the parent of each wxCheckbox is the wxScrolledWindow.
4. Create two wxBoxSizer(wxVERTICAL).
5. Add the checkboxes to one of the sizers.
6. Add the wxScrolledWindow to the other sizer.
7. Use something like myScrolledWindow->SetSizer( myCheckboxSizer );
8. Use SetSizer(myScrolledWindow); for the frame.

Problem is that you don't "add" to the window, but to its sizer and then set the sizer for the window.

upCASE
-----------------------------------
If it was hard to write, it should be hard to read!- Do. Or do not. There is no try!
Forum List • Thread List • Reply • Refresh • New Topic • Search • Previous • Next First 1 Last
掌柜推荐
 
 
¥1,360.00 ·
 
 
¥271.00 ·
 
 
¥880.00 ·
 
 
¥980.00 ·
 
 
¥890.00 编辑
 
 
¥918.00 ·
© Sun 2024-11-24  Guidance Laboratory Inc.
Email:webmaster1g.yi.org Hits:0