Hello,
I have an app where the user has the option to block resizing of the columns in a list control.
To do this, I have made the list control handle messages from the embedded header control:
ON_NOTIFY(HDN_BEGINTRACK, 0, OnColumnTrackBegin)
ON_NOTIFY(HDN_DIVIDERDBLCLICK, 0, OnColumnDoubleClick)
The handlers look like this:
void MyListCtrl::OnColumnTrackBegin(
NMHDR* pNMHDR, LRESULT* pResult)
{
*pResult = m_bFieldSizingAllowed ? 0 : 1;
}
void MyListCtrl::OnColumnDoubleClick(
NMHDR* pNMHDR, LRESULT* pResult)
{
*pResult = m_bFieldSizingAllowed ? 0 : 1;
}
This works fine for the OnColumnTrackBegin (i.e. the user cannot resize the columns if bFieldSizingAllowed = FALSE
However, this does not work for the double click. Whether bFieldSizingAllowed = TRUE or FALSE, processing does not continue and the double click does nothing.
Am I doing something wrong? I don't want to have to think about sub-classing the header control if at all possible!
Thanks for any help,
Stuart
I have an app where the user has the option to block resizing of the columns in a list control.
To do this, I have made the list control handle messages from the embedded header control:
ON_NOTIFY(HDN_BEGINTRACK, 0, OnColumnTrackBegin)
ON_NOTIFY(HDN_DIVIDERDBLCLICK, 0, OnColumnDoubleClick)
The handlers look like this:
void MyListCtrl::OnColumnTrackBegin(
NMHDR* pNMHDR, LRESULT* pResult)
{
*pResult = m_bFieldSizingAllowed ? 0 : 1;
}
void MyListCtrl::OnColumnDoubleClick(
NMHDR* pNMHDR, LRESULT* pResult)
{
*pResult = m_bFieldSizingAllowed ? 0 : 1;
}
This works fine for the OnColumnTrackBegin (i.e. the user cannot resize the columns if bFieldSizingAllowed = FALSE
However, this does not work for the double click. Whether bFieldSizingAllowed = TRUE or FALSE, processing does not continue and the double click does nothing.
Am I doing something wrong? I don't want to have to think about sub-classing the header control if at all possible!
Thanks for any help,
Stuart