Detect focus change in parent window(s) of treeview - c++

Ok this seems pretty straightforward but how to do this? The edit controls send an EN_KILLFOCUS message, but I can't really find something similar for the treeview control.
Exact situation: Parent window (a property sheet page) creates a custom control that has a treeview on it (just the plain old SysTreeView32).
My best idea until now is to subclass the control that holds the treeview and the treeview itself, but thats no joy...

The message you are looking for is NM_KILLFOCUS.

Related

Customizing QTreeWidget's child indicator

I have implemented a custom child indicator for a QTreeWidget as a QPushButton and still in the process of making it look like the original. My question is if anyone knows what control does Qt use for the child indicator, or is it some other control, like a customized QLabel? I have implemented it by sub-classing QPushButton with QPushButton::setFlat(true) and QPushButton::setCheckable(true). But I still see the inflate/deflate behavior of the control when I click on it, just like it happens with QPushButton. So, should I continue styling the button until I get the desired behavior, or should I sub-class another Qt widget instead?
Here's the screenshot of a typical QTreeWidget with a child indicator. I want to know what control does Qt use for it:

How do I get messages to embedded dialogs in MFC?

I seem to have the original problem from Embedded Modeless Child Dialog not getting messages. I have managed to add rows to my property page using tips form What is the best way to manage data for rows of similar controls in MFC? but now when I click on the controls in the embedded dialog, nothing happens. I assume there's some message routing I need to do in the parent dialog but I don't know what it is.
The properties of the row dialog resource included Disabled = True. I have no idea how that happened.

Preventing Mouse-wheel scrolling of controls

I am developing an application using the MFC library and I am currently trying to prevent the user accidentally changing one of the combo box controls when they are scrolling the mouse wheel.
I am looking for a solution without deriving a new class from the CComboBox class and preventing the mouse scrolling there.
My understanding of the system is that Windows passes the WM_MOUSEWHEEL message to the Combo box control which handles it (scrolling the combo box) and then this is propagated up the chain of parent controls (so them to my CFormView etc.), which means I cannot prevent the scrolling by capturing the event in my form view.
Does anyone have a solution to this problem? Thanks in advance!
You can always derive a control from CComboBox and trap the WM_MOUSEWHEEL message in the control itself. Then simply use your new derived combo box in your form view.
If you don't want to create a derived class (perhaps it's too big a change for your project), you can subclass the combo box and trap the WM_MOUSEWHEEL there.
Override the PreTranslateMessage handler in the main window class and look for WM_MOUSEWHEEL messages. Compare the pMsg->hwnd handle in PreTranslateMessage handler with the combobox handle, if found, filter the messages away.

how to add child window controls to CWindowImpl

How do I add simple child window controls (e.g. a button) to a CWindowImpl?
I've looked at CWindowImpl and CDialogImpl. With CDialogImpl, it appears that you just create a dialog template resource and use it, very simple. I would like to do something similar with CWindowImpl, but there doesn't seem to be a way to do it. Must I add the controls manually and position them programmatically?
Some context on what I'm trying to do: I'm trying to create a plug-in for foobar2000, a Windows audio player. I would like to create a "UI element" plugin, and in the sample code that I've looked at, a "UI element" is created via CWindowImpl. How do I add buttons to this CWindowImpl? I've tried using a CDialogImpl instead, but this gives me a "pop-up" dialog, which is not what I'm looking for.
Thanks very much in advance!
With any window, including CDialogImpl, you can add child controls by creating a new window of control class and specifying your parent window handle as a parent for new control. Additionally, SetParent API is here to re-parent any window.

How to make Qt delegate editors 'sticky'

I'm migrating an application from a homegrown UI to Qt. One of the most important controls is the property panel, which takes an object that implements my reflection API's interface and spits out a dialog box containing editors for all the properties.
I've written an implementation of QAbstractItemModel for my property system and I've written a few handlers for various types inside of a QTableView. I've also written a QItemDelegate to create editors for the properties.
The trouble is that I'd like the editors to hang around, rather than be strictly popups. This is so that they can handle the rendering of the property, require less clicks to operate and also not disappear as soon as something else gets the focus, such as my colour button - the editor (which has the slots listening for colour changes) disappears as soon as the colour picker dialog appears, which means that nothing is then listening for changes.
I can't find any options for making the editors persist. Am I barking up the wrong tree here or is there a more appropriate way of doing this? I've tried to do things the 'Qt' way but I'm already hitting brick walls.
Thanks,
There is the QAbstractItemView::openPersistentEditor() method.