MFC: How to create options dialog with listbox and multiple pages? - c++

Developing using Visual Studio 2010 C++ and MFC. I want to create an options (preferences/settings) dialog box that can display several options. After considering many different options dialog box UIs I think I like the listbox-with-multiple-pages-style similar to visual studio's option dialog box (but I don't need the treeview, a list box is fine).
What's a good way to implement this? Do I use a CListBox and then handle the selection event to load up the individual pages? I'm new to MFC, what would the individual pages even be? Something like a panel? Ideally I would design them in the resource editor and then be able to load them up.

Take a look at http://www.codeproject.com/KB/dialog/embedded_dialog.aspx for one possible way of doing this.
The individual property pages can be designed as dialogs in the resource editor, and then the relevant page can be displayed in your main dialog depending on the selection in the list box, by handling the LVN_ITEMCHANGED message.

See CPropertySheet and CPropertyPage classes. This allows you to easily manage a properties window with several views.

Related

Does MFC CRichEditCtrl has a display level?

i'm currently working on a legacy project in MFC.
I encounter an issue where i create a bunch of CRichEditCtrl objs in the view, many of them are overlapping each other. When i select them, the visual is totally messed up.
Is it possible to click on a particular control and bring it to the "foreground". so i can edit on that particular control?
Other question is that is there a way to distinguish those controls dynamically?
I know when i create them, the last parementer is their ID. But when i click on those, i want command handler in parent dialog or view knows which one i'm about to edit.
Thanks in advance

How to add or remove textboxes by changing the options in the combobox in Visual c++?

I want to know that whether I can add a textbox or label by changing the options in combo box. For example, I have 2 options in Combobox. If I choose the #1, it must show me 2 textboxes, but if I choose #2 it must show 3 textboxes.Can I do something like this in Visual Studio C++?
This can be done in two ways:
Dynamically create and destroy the edit controls using CreateWindowEx and DestroyWindow.
Statically create your GUI with 3 edit controls and set the visibility of the controls based on the selection using ShowWindow.
Have as many text-boxes you want. But hide them.
Handle CBN_SELCHANGE (ON_CBN_SEL_CHANGE in MFC).
In the handler, show (or hide) the text boxes depending on selection.
Showing/hiding text boxes aren't good from UI perspective. You better enable/disable them appropriately. You may put alternate text when they are disabled, and bring back original change when they have to be enabled.
Creating textboxes at runtime, and then deleting them isn't' good approach. You will need to keep track of Win32 UI handle and/or MFC object. This approach will also need more of UI resource creation/deletion, parent-child relationship handling et. al.

wizard (or an alternative) in an aui managed pane

I would like to have wizard in my application. but I don't want the focus to be on the wizard until the wizard is finished. That's what happens if I use wx.wizard. I prefer to load the wizard in an aui pane. So the user can switch to main window even in the middle of the wizard. I can have panels on top of each to make a wizard. Kindly point me if there is a better Pythonic way of doing that.
Thank you in advance.
The Wizard "widget" in wxPython is basically a dialog. I don't think you can embed it in your application. You might be able to extend the widget somehow to do so, but that would likely be a lot of work.
Instead, I would just create a set of panels that are your wizard pages. You will need a main panel that has some buttons on it that you place your pages on. Then when you hit the button, it will show the next page. I wrote a tutorial on the subject a couple years ago that should get you started:
http://www.blog.pythonlibrary.org/2012/07/12/wxpython-how-to-create-a-generic-wizard/

Creating tabbed document interfaces in Qt Designer?

I am trying to write a program that will use a tabbed document interface (TDI) like seen in Notepad++ or most web browsers. I know how to build GUIs using Qt Designer, and code in Qt C++ (after a few days of playing around).
I have created an example of what each page widget will look like using Designer, and now I want to add the ability to create and testroy tabs at runtime, each containing a unique instance of the page widget. However, I have no idea how to do this without adding a class that extends QWidget, and building the page widget with code. I could go down this route, but I'm sure there must be a better way of creating a TDI; but I can't find any tutorials or examples of how to do this.
Does anyone have any suggestions?
For creating tab interfaces you should look into QTabWidget.
It is a container widget included in Qt Designer which automatically handles operations on tabs. It has several build in methods for manipulating its tabs and theirs contents.
Each page of QTabWidget is handled separately and can have different layouts and functionality.
If you want to include several different objects to one page assign a layout to it and then assign the objects to the layout.

MFC Menu Drop Down (Screenshot included)

I'm having difficulties with an MFC application menu drop down. I want the drop down to display all items when it is clicked. Instead it displays arrows which the user must click in order to show the drop down items.
See the pic below. Any help would be appreciated. Thanks!
I believe this is a feature of the MFC feature pack where the menu will hide rarely used items. You should be able to disable this feature using the CMFCMenuBar::SetShowAllCommands method.