Click here to Skip to main content
15,895,084 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: CListCtrl - header notification ??? Pin
Michael Dunn30-Dec-01 19:20
sitebuilderMichael Dunn30-Dec-01 19:20 
GeneralRe: CListCtrl - header notification ??? Pin
Christian Graus31-Dec-01 1:05
protectorChristian Graus31-Dec-01 1:05 
GeneralRe: CListCtrl - header notification ??? Pin
Michael Dunn31-Dec-01 7:33
sitebuilderMichael Dunn31-Dec-01 7:33 
GeneralRe: CListCtrl - header notification ??? Pin
Christian Graus1-Jan-02 0:59
protectorChristian Graus1-Jan-02 0:59 
GeneralRe: CListCtrl - header notification ??? Pin
Jonas Larsson1-Jan-02 23:20
Jonas Larsson1-Jan-02 23:20 
GeneralRe: CListCtrl - header notification ??? Pin
Christian Graus2-Jan-02 0:14
protectorChristian Graus2-Jan-02 0:14 
GeneralRe: CListCtrl - header notification ??? Pin
Jonas Larsson2-Jan-02 0:36
Jonas Larsson2-Jan-02 0:36 
GeneralRe: CListCtrl - header notification ??? Pin
Jonas Larsson4-Jan-02 4:26
Jonas Larsson4-Jan-02 4:26 
I did some testing yesterday. I create a subclassed CListCtrl in a childview and the only extra stuff I have is this in OnNotify (see below). It keeps the total column width to 240 the whole time and doesnt flicker at all (as opposed to the CE version of CListCtrl, which decides to draw the bottom scrollbar each time before I get a chance to resize the columns)

The only diffrence with this and the earlier version is that I look for HDN_xxxA and HDN_xxxW instead of just HDN_xxx.

Let me know if you still cant get it to work.

BOOL CNumbersListCtrl::OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult) 
{
    HD_NOTIFY *phdn = (HD_NOTIFY *)lParam; 
    switch(phdn->hdr.code)
    { 		
        case HDN_BEGINTRACKA:
        case HDN_BEGINTRACKW:
        {
            // Trap the HDN_BEGINTRACK message
            TRACE(_T("CNumbersListCtrl::OnNotify -- HDN_BEGINTRACK Trapped\n"));
            SetRedraw(false);
            // *pResult = 1;  // Set to 1 and return TRUE to prevent tracking 
            return(FALSE);  // return FALSE to allow tracking of the divider 
            break; 		
        }
        case HDN_ENDTRACKA:
        case HDN_ENDTRACKW:
        {
            int windowsize = 225;   
            TRACE(_T("CNumbersListCtrl::OnNotify -- HDN_ENDTRACK Trapped\n"));

            SCROLLINFO si; // check if scrollbar is visible
            if (GetScrollInfo(SB_VERT, &si))
            {
                if ((int) si.nPage <= (si.nMax-si.nMin))
                    windowsize = 225;
                else
                    windowsize = 240;
            }
            else
                windowsize = 240;
			
            if (phdn->iItem == 0)
	    {
                int left = phdn->pitem->cxy;
                TRACE(_T("CNumbersListCtrl::OnNotify -- Resize right to fit\n"));
                SetColumnWidth(1, windowsize - left);
            }
            else if (phdn->iItem == 1)
            {
                int right = phdn->pitem->cxy;
                TRACE(_T("CNumbersListCtrl::OnNotify -- Resize left to fit\n"));
                SetColumnWidth(0, windowsize - right);
            }	
            SetRedraw(true);
            Invalidate();
            break;
        }
    }	 	
    return CListCtrl::OnNotify(wParam, lParam, pResult); 

}

GeneralRe: CListCtrl - header notification ??? Pin
Christian Graus4-Jan-02 10:36
protectorChristian Graus4-Jan-02 10:36 
AnswerRe: CListCtrl - header notification ??? Pin
Fazlul Kabir4-Jan-02 5:23
Fazlul Kabir4-Jan-02 5:23 
GeneralRe: CListCtrl - header notification ??? Pin
Fazlul Kabir4-Jan-02 5:34
Fazlul Kabir4-Jan-02 5:34 
GeneralRe: CListCtrl - header notification ??? Pin
Christian Graus4-Jan-02 10:34
protectorChristian Graus4-Jan-02 10:34 
GeneralRe: CListCtrl - header notification ??? Pin
Fazlul Kabir4-Jan-02 10:48
Fazlul Kabir4-Jan-02 10:48 
GeneralRe: CListCtrl - header notification ??? Pin
Christian Graus4-Jan-02 11:12
protectorChristian Graus4-Jan-02 11:12 
GeneralRe: CListCtrl - header notification ??? Pin
Fazlul Kabir4-Jan-02 12:45
Fazlul Kabir4-Jan-02 12:45 
GeneralAaaAAaAARRrRRgGgHHH!!!! KERNEL32.DLL ERROR!! Pin
Rickard Andersson2030-Dec-01 12:08
Rickard Andersson2030-Dec-01 12:08 
Generalno focus Pin
Rickard Andersson2030-Dec-01 12:13
Rickard Andersson2030-Dec-01 12:13 
GeneralRe: AaaAAaAARRrRRgGgHHH!!!! KERNEL32.DLL ERROR!! Pin
squizz31-Dec-01 4:37
squizz31-Dec-01 4:37 
GeneralRe: AaaAAaAARRrRRgGgHHH!!!! KERNEL32.DLL ERROR!! Pin
Rickard Andersson2031-Dec-01 5:03
Rickard Andersson2031-Dec-01 5:03 
GeneralOptimizing memory usage Pin
IGx8930-Dec-01 11:53
IGx8930-Dec-01 11:53 
GeneralRe: Optimizing memory usage Pin
Konstantin Vasserman30-Dec-01 15:44
Konstantin Vasserman30-Dec-01 15:44 
GeneralRe: Optimizing memory usage Pin
IGx8930-Dec-01 15:58
IGx8930-Dec-01 15:58 
GeneralRe: Optimizing memory usage Pin
Konstantin Vasserman30-Dec-01 16:15
Konstantin Vasserman30-Dec-01 16:15 
Questionhow'd they do that? Pin
hforbess30-Dec-01 11:28
hforbess30-Dec-01 11:28 
AnswerRe: how'd they do that? Pin
Michael P Butler31-Dec-01 1:59
Michael P Butler31-Dec-01 1:59 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.