Guidance Forums / wxWidgets (wxWindows) in C++ / newbie needs help with wxWindows

Search 搜索
Home Home

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

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:

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

But there is not possible to:  (pseudocode)

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

Message2. Re: newbie needs help with wxWindows
Posted by: upCASE 2004-01-27 16:55:18
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.

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
© Thu 2023-12-7  Guidance Laboratory Inc. Hits:0