Does MFC CRichEditCtrl has a display level? - c++

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

Related

How do I invoke an ActiveX control's property page?

I have created an ActiveX control that uses five different colors. I would like to the control's property page to let the user choose the R, G and B values for each of the five colors. That won't be a problem. My problem is: how do I display the property page? For the sake of this question, let's say I want to connect it to the control's double-click event. The user would double-click on the control and the property page dialog box would appear. What code would have to be in the event handler to do that?
And yes, I know I'm working with antique technology. So is the rest of my company, and far too many other companies.
In case it matters, I'm writing the control in C++ using Visual Studio 2012.
As I was about to ask this question over on reddit since I don't have an answer here yet, it occurred to me that one would want to invoke a control's property page from the control's container, not the control itself. So, I went to my test application, typed my instance's variable name, and Intellisense showed me that the control has a property named ShowPropertyPages().

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/

windows forms, how to launch a separate window with datagridview?

I've some data that can be shown on grid attached on a panel. When user clicks some button i'm showing this panel. Now i wanted to launch this grid in a separate window(should be a child to existing window) and want to make the grid editable, click controls...etc, is it possible?
thanks in advance.
You should be able to achieve this effect by placing your grid on a separate form, complete with editing stuff. Disable the form and set its parent, (see control.parent), to be the main form panel. When the user wants to edit it, set the grid-form parent to nil and enable it.
Not actually tried this with WinForms, but it works fine with Delphi VCL so worth a test if no better answers are forthcoming
Rgds,
Martin

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

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.