We are using a CXTPPropertyGrid in a Pane (actually in a view in a Pane) to edit data, and we need to detect when the user leaves the Grid in order to handle update logic (such as unsaved changes, etc).
In the application's CMainFrame class, we handle XTPWM_DOCKINGPANE_NOTIFY, and look for XTP_PANE_ACTION. We want to handle any deactivation of the Property Pane. The code is like this:
if (wParam == XTP_DPN_ACTION) {
XTP_DOCKINGPANE_ACTION * pAction = (XTP_DOCKINGPANE_ACTION *)lParam;
// CString dbg; dbg.LoadStringA(pAction->pPane->GetID());
// TRACE3("%s: ID %d, action %d, ", dbg.GetBuffer(), pAction->pPane->GetID(), pAction->action);
if(pAction->pPane->GetID() == IDR_PANE_PROPERTIES) {
XTPDockingPaneAction action = pAction->action;
if(action == xtpPaneActionDeactivated) {
TRACE( "Deactivating Property Pane\n");
CWnd * window = pAction->pPane->GetChild();
window->SendMessageToDescendants(WM_CFTPO_CLOSEVIEW);
}
}
}
This works well, with one exception. The problem we have is that we get this message, and fall into the "Deactivating Property Pane" code, if the user selects a value in a drop down calendar in a CXTPPropertyGridItemDate object.
It seems that the drop down calendar is a CWnd of its own, and that it therefore Posts the deactivation notification regarding the Property Grid, just as though it were some external window.
Is there a way to avoid this? If there was a way to tell if the xtpPaneActionDeactivated notification was provoked by a move into a Child window of the property pane, then notifications from a Calendar drop down could be ignored.
I am sure that we are not the only people using CXTPPropertyGridItemDates and trying to detect departures from the CXTPPropertyGrid -- has anyone else come across the issue?
Any help or hints appreciated,
|