CHeaderCtrl and HDN_TRACK

No, not the usual problem of not getting these notifications at all, just
for a change!

The problem is that I want to limit the width of a header item - the user
shouldn't be able to drag it narrower than a minimum width or wider than a
maximum width which I wish to set separately for each item.

How?

All I can find so far is setting *pResult non-zero - as advertised this
stops the drag continuing but that's not what I want, I want the drag to
appear to hit an "end stop" so that the user can drag back again the other
way.

A little later ... well, whaddyou know, you overwrite the cxy whilst
processing the notification!! Not exactly documented terribly clearly, eh?
So I'm posting this anyway in the hope of saving someone else some time one
day ...

--
Tim Ward
Brett Ward Limited - www.brettward.co.uk


0
tw2 (223)
3/31/2005 11:49:54 AM
vc.mfc 33608 articles. 0 followers. Follow

0 Replies
380 Views

Similar Articles

[PageSpeed] 44

Reply:

Similar Artilces:

Problems manually creating a CHeaderCtrl in a custom control (derived from CWnd)
Hi, i'm trying to write a custom ListCtrl syle control with an integrated CHeaderCtrl but i'm running into some initialisation problems. My control is derived from CWnd like this: class CScrollCtrl : public CWnd { private: CHeaderCtrl m_HeaderCtrl; .... }; then i initialise the header-control like this: CScrollCtrl::PreSubclassWindow() { CWnd::PresubclassWindow(); ... m_HeaderCtrl.Create(...., this, .....); .... } I'm testing this control in a dialog-based test application with one instance created by placing a custom-control in the MFC dialog editor and...

CHeaderCtrl #3
I am trying to initalize a CHeaderCtrl pointer but it doesn't work. I am using VS 2005 and this is what I have <code> CListCtrl& theListCtrl = GetListCtrl(); ASSERT(theListCtrl); CHeaderCtrl* pHdCtrl = theListCtrl.GetHeaderCtrl(); ASSERT(pHdCtrl); <code> It is not being initialized. -- Just Al I forgot to mention that this code is a derived class of CListView. CListView::InitListView(); -- Just Al "Al" wrote: > I am trying to initalize a CHeaderCtrl pointer but it doesn't work. I am > using VS 2005 and this is what I have > > <code&...

problems with CHeaderCtrl
We are using CHeaderCtrl with CListCtrl in the report view format. Sometimes, when a column in the header is clicked on (for sorting), the first column in the header goes blank. The column is still there but the column name no longer appears. This seems to only be an issue in NT and 2000, not XP. Has anyone encountered this before? ...

About HDN_TRACK event of CListView or CListCtrl
Did you ever encounter that HDN_TRACK event never sent for CListView or CListCtrl. I added an message handler of HDN_TRACK of an CListView. But it never happens. I also added message anders of HDN_BEGINTRACK & HDN_ENDTRACK, these two events happened as expected. Why HDN_TRACK never happen? Is there are some bugs in MFC? "Leon" <chi_jinliang@toyoda-tast.com> wrote in message news:%23XACfoz6FHA.1276@TK2MSFTNGP09.phx.gbl... > Did you ever encounter that HDN_TRACK event never sent for CListView or > CListCtrl. > > I added an message handler of HDN_TRACK of ...

cheaderctrl
Hi there, I have a class derived from CWnd with a member pointer of a class type that is derived from a CListCtrl. I also have a CHeaderCtrl derived class. Where do I place my member CHeaderCtrl-derived class variable and how do I initialize so that it has a handle to the listCtrl's (this listCtrl being the one pointed to by the member pointer above) header? Thank you. ...

CHeaderCtrl / HDITEM
Hello I'm little bit confused with CHeaderCtrl control. I'll be a very glad if somebody can help me to solve problem. The problem is concerning the way how to read HDITEM structure from the CHeaderCtrl object by using GetItem method. I was read the following text from the MSDN/CHeaderCtrl::GetItem "Any flags set in the mask element ensure that values in the corresponding elements are properly filled in upon return." So if I understood correctly I always have to set the mask member correctly before calling GetItem method. I checked MSDN/MFC sample LISTHDR and it seems...

dynamically changing CHeaderCtrl size in CListCtrl............
I am dynamically changing the height of the header control (CHeaderCtrl) in my list control (CListCtrl). I derived CMyHeaderCtrl from CHeaderCtrl and intercept message HDM_LAYOUT, so that I can set the header control height to a desired value corresponding to current program state. Then in the list control code, I send message HDM_LAYOUT to the header control or call pMyHeaderCtrl->Layout(), after getting the value, I call pMyHeaderCtrl->SetWindowPos(...) to change the header control height. Everthing works fine up to now, I can successfully change the header control height. Howe...

hide divider in CHeaderCtrl
Hello, I have a CListCtrl object, setup as Report view. I would like to remove the dividers from between each column in the listctrl header (small vertical lines). I was able to access the CHeaderCtrl object and disable the window, so that the columns cannot be resized, but how can I completely hide the dividers? Thanks in advance for help. Mike Martin >Hello, I have a CListCtrl object, setup as Report view. I would like >to remove the dividers from between each column in the listctrl header >(small vertical lines). I was able to access the CHeaderCtrl object >and disable ...

CHeaderCtrl question
Hi, I try to add the HDS_DRAGDROP to the header control of a list control: void CTestView::OnInitialUpdate() { CView::OnInitialUpdate(); // TODO: Add your specialized code here and/or call the base class CHeaderCtrl *cHeaderCtrl; BOOL b; cListCtrl.Create(LVS_REPORT|WS_VISIBLE|WS_CHILD|WS_BORDER,CRect(10,10,300,20 0),this,1); cListCtrl.InsertColumn(0,"Date",LVCFMT_LEFT,100); cListCtrl.InsertColumn(1,"Name",LVCFMT_LEFT,200); cHeaderCtrl=cListCtrl.GetHeaderCtrl(); b=cHeaderCtrl->ModifyStyleEx(0,HDS_DRAGDROP); // returns 1 } This doesn't work. Can anyo...

cheaderctrl problem
Hi There, I have a CWnd derived class, CMyCtrl that contains a member of type CQuickList* (a CListCtrl derived class). I also have a CHeaderCtrl derived class, CMyHeaderCtrl. In order to access methods in CMyHeaderCtrl, I should have a CMyHeaderCtrl member in either CMyCtrl or CQuickList, where? Also once I have that, it needs to be initialized so that it has a handle to the list's header, where and how do I do that? I'm aware that I need to do something along the lines of: m_objHeaderCtrl.SubclassWindow(this->GetHeaderCtrl()->GetSafeHwnd()); where m_objHeaderCtrl is of typ...

CHeaderCtrl font
How do you get the font that is used by a CHeaderCtrl? GetFont() always returns 0. Thanks ...

CHeaderCtrl and HDN_TRACK
No, not the usual problem of not getting these notifications at all, just for a change! The problem is that I want to limit the width of a header item - the user shouldn't be able to drag it narrower than a minimum width or wider than a maximum width which I wish to set separately for each item. How? All I can find so far is setting *pResult non-zero - as advertised this stops the drag continuing but that's not what I want, I want the drag to appear to hit an "end stop" so that the user can drag back again the other way. A little later ... well, whaddyou know, you overwri...

CHeaderCtrl and HDF_SORTDOWN
Hi, I'm trying to display the little sort bitmap beside my text within my ListView column. In the HDITEM structure used by CHeaderCtrl, it's written that a HDF_SORTDOWN and HDF_SORTUP can be displayed. BUt i can try what i want, nothing is displayed. is there some problem with this feature or it's me who don't know how to use it ? could you give me a piece of working code please ? thx, Maileen Maileen this feature is only available with version 6 of comctl32.dll which is only available in Windows XP. For more information look up the HDITEM structure in MSDN. Kurt &q...

CHeaderCtrl #2
MFC is just the thing for me it seems, plently of vexation to while away the hours. *sigh* I am trying to inser a bitmap in the fourth column of my header control, attached to a list ctrl. After reading the docs and codeproject resources, here's what I came up with: void MyViewClass::OnInitialUpdate() { [creation code for List Ctrl, "List"] ..... CHeaderCtrl* pHead = List.GetHeaderCtrl(); CBitmap bm; bm.LoadBitmap(IDB_BITMAP3); HDITEM hdi; pHead->GetItem(4,&hdi); hdi.mask |=HDI_BITMAP|HDI_FORMAT; hdi.fmt |=HDF_BITMAP; hdi.fmt &=~HDF_STRING; ...

Using lparam in cheaderctrl
Hi there, I know that when insertcolumn is called from inside a clistctrl, it takes care of calling methods in header control to add the header text. However is there a way of sending some more information. I want to make use of the cheaderctrl's (HD_ITEM'S) lparam which is supposed to be an application define lparam. Can I do this at the time of inserting the columns? If not, when and how can I do it? Because then when I get a notification of onheaderclicked, I want to be able to read the value stored in this lparam to do stuff accordingly. Thank you. I think it's kinda anno...

Resizing columns in CHeaderCtrl
Hello, How can I resize columns in CHeaderCtrl so that their width is equal to the width in pixels of header string? Regards, Vladimir. I think this was answered well in comp.os.ms-windows.programmer.win32 On Mon, 15 Sep 2003 14:48:53 +0600, "Vladimir" <genisoft@ufacom.ru> wrote: >Hello, > >How can I resize columns in CHeaderCtrl so that their width is equal to the >width in pixels of header string? > >Regards, >Vladimir. > > ----------------------------------------- To reply to me, remove the underscores (_) from my email address (and please ...

Mouse up event for CHeaderCtrl
Hi there, I have a CListCtrl derived class along with CHeaderCtrl derived class. I've read through various posts on handling column resize and drag events, which is what I want to do. Make a record of the new order or column width once performed. However, from all posts it seems like the HDN_ENDTRACK or HDN_ENDDRAG all take place before the mouse primary button is left go of. So if I were to check the column order or width at this time, I would not get the new/updated information just yet. So I decided to simply set flags when a drag or resize is detected and then try and detect a mous...

How to add controls to CHeaderCtrl?
Hi, Could you plz tell me how to add control like button to CHeaderctrl.... thanx.. Is this a header for a list control? AliR. "vakiti" <vakiti1024@gmail.com> wrote in message news:bad27dd4-142c-4646-8f0e-e57002a3bd61@q26g2000prq.googlegroups.com... > Hi, > > Could you plz tell me how to add control like button to > CHeaderctrl.... > thanx.. But a CHeaderCtrl CAN be a button. What do you mean "like a button"? Either it is, or it isn't. joe On Wed, 26 Nov 2008 00:20:40 -0800 (PST), vakiti <vakiti1024@gmail.com> wrote: >Hi, ...

CHeaderCtrl.SetOrderArray does not work?
I try to inverse items of header control. fowllowing is snippet of code: // Inverse order of columns int nCount = m_wndHeader.GetItemCount(); int *lpiOrder = new int[nCount]; int *lpiOrderInverse = new int[nCount]; m_wndHeader.GetOrderArray(lpiOrder, nCount); for(int i=0; i<nCount; i++) { lpiOrderInverse[nCount - i] = lpiOrder[i]; } m_wndHeader.SetOrderArray(nCount, lpiOrderInverse); delete lpiOrder; delete lpiOrderInverse; /////// End code while it run to "m_wndHeader.SetOrderArray", always a error occurs in "AfxUnlockGlobals". then, I change s...

cheaderctrl problem #2
Hi There, I have a CWnd derived class, CMyCtrl that contains a member of type CQuickList* (a CListCtrl derived class). I also have a CHeaderCtrl derived class, CMyHeaderCtrl. In order to access methods in CMyHeaderCtrl, I should have a CMyHeaderCtrl member in either CMyCtrl or CQuickList, where? Also once I have that, it needs to be initialized so that it has a handle to the list's header, where and how do I do that? I'm aware that I need to do something along the lines of: m_objHeaderCtrl.SubclassWindow(this->GetHeaderCtrl()->GetSafeHwnd()); where m_objHeaderCtrl is of typ...

CHeaderCtrl message handling
Hi, I'm writing a CScrollView-derived window that will display columnar data using the CHeaderCtrl. I cannot use the CListView as I will need to display more than one row of data in some columns than others - whilst also supporting smaller, embedded, views of the same type expanding out as needed (in the same way as sub-datasheets in Access). There's loads of issues that I'll need to address with this, I know, but my main problem at the moment is handling the HDN_TRACK message, sent by the CHeaderCtrl to the main view whilst the user resizes a column so I can redraw t...

cheaderctrl member method
Hi there, I have a class derived from CWnd with a member pointer to a class derived from CListCtrl. I also have a CHeaderCtrl derived class. My question is that where to I place the headerctrl derived member and then how to I initialize it such that it has the handle to the listCtrl's (this listCtrl being derived from CListCtrl) header. Thank you. ...

Subclass Header Control (CHeaderCtrl)
I'm trying to subclass the header control that's inside a CListCtrl, and I'm having problems. It should work regardless of whether the CListCtrl is created manually with a call to CListCtrl::Create() or "automatically" when Windows creates a dialog from a resource template. That means I can't put the call to CHeaderCtrl::SubclasssWindow inside the CListCtrl::OnCreate handler, since CListCtrl::OnCreate is never called when Windows creates the the listview control from a dialog resource; rather it needs to go in the CListCtrl::PreSubclassWindow call, which is called re...

cheaderctrl member method #2
Hi there, I have a class derived from CWnd with a member pointer to a class derived from CListCtrl. I also have a CHeaderCtrl derived class. My question is that where to I place the headerctrl derived member and then how to I initialize it such that it has the handle to the listCtrl's (this listCtrl being derived from CListCtrl) header. Thank you. ...

CHeaderCtrl::GetItem() crashes my application
Hi all! i am using following code to sort my items in Listcontrol. but the following line the given code crashes the application ====>> hdrCtrl->GetItem(m_nPrevSortColIndex, &hi); In debug window it shows following error: m_nPrevSortColIndex :: -1 , m_nSortColIndex :: -1 m_nPrevSortColIndex :: 0 , m_nSortColIndex :: 0 hdrCount :: 7 Warning: calling DestroyWindow in CDialog::~CDialog -- OnDestroy or PostNcDestroy in derived class will not be called. First-chance exception in X-Analysis.exe (KERNEL32.DLL): 0xC0000005: Access Violation. CODE : BOOL CXListCtrl::SortItems(PFNL...