15 мая 2023 года "Исходники.РУ" отмечают своё 23-летие!
Поздравляем всех причастных и неравнодушных с этим событием!
И огромное спасибо всем, кто был и остаётся с нами все эти годы!

Главная Форум Журнал Wiki DRKB Discuz!ML Помощь проекту


Disabling Column Sizing in CListCtrl

Jeff Moss -- jeff.moss@gtri.gatech.edu
Tuesday, September 24, 1996

Environment: VC 4.0, WinNT 3.51

I've tried trapping LVM_SETCOLUMNWIDTH, and the various LVN_* notifiers but
it seems that the actual sizing is done somewhere beyond my control.

The CListCtrl I use is my own derived class and is OWNERDRAW_FIXED.

Has anyone done this successfully?

MOSS, JEFFREY N --- Research Scientist
ITL/CSITD 
Georgia Tech Research Institute
Georgia Institute of Technology
Atlanta Georgia, 30332

jeff.moss@gtri.gatech.edu

(404) 894-5959 (voice)
(404) 894-7080 (fax)




IK 23 -- Cunningham@tgd.swissptt.ch
Thursday, September 26, 1996

[Mini-digest: 2 responses]

you have to trap the listctrl onnotify message somthing like the code
below

BOOL CExtListCtrl::OnNotify(WPARAM wParam, LPARAM lParam, LRESULT*
pResult) 
{
	UINT code = ((NMHDR*)lParam)->code;
	int nColumn;
	CRect rect;

	switch (code)
	{
		case HDN_ENDTRACKA: //Done this cause winnt always uses a unicode
header ctrl.
		case HDN_ENDTRACKW:
		case HDN_BEGINTRACKA:
		case HDN_BEGINTRACKW:
		case HDN_TRACKA:
		case HDN_TRACKW:
			//do what you want here to handle these events
			break;
		default:
			break;
	}
	
	return CListCtrl::OnNotify(wParam, lParam, pResult);
}

Graham Cunningham
00 41 31 338 0633

>----------
>From: 	jeff.moss@gtri.gatech.edu[SMTP:jeff.moss@gtri.gatech.edu]
>Sent: 	Dienstag, 24. September 1996 23:19
>To: 	mfc-l@netcom.com
>Subject: 	Disabling Column Sizing in CListCtrl
>
>Environment: VC 4.0, WinNT 3.51
>
>I've tried trapping LVM_SETCOLUMNWIDTH, and the various LVN_* notifiers
>but
>it seems that the actual sizing is done somewhere beyond my control.
>
>The CListCtrl I use is my own derived class and is OWNERDRAW_FIXED.
>
>Has anyone done this successfully?
>
>MOSS, JEFFREY N --- Research Scientist
>ITL/CSITD 
>Georgia Tech Research Institute
>Georgia Institute of Technology
>Atlanta Georgia, 30332
>
>jeff.moss@gtri.gatech.edu
>
>(404) 894-5959 (voice)
>(404) 894-7080 (fax)
>
>
-----From: Mario Contestabile

BOOL  YourListCtrl::OnNotify(...){

     BOOL bret = TRUE;
     if ((NMHDR*)lParam)->code == HDN_BEGINTRACK)
         bret = FALSE;

    *pResult = 0;
    return bret;
}




Asaf Kashi -- kashi@sr.hp.com
Friday, October 18, 1996

I tried using your method and I can verify that I am intercepting the =
HDN messages in the switch statement.  I want to ignore these message =
and not let the user resize, so I tried sending a TRUE and then later =
FALSE(just to see if it changes anything)  Neither one did what I =
wanted.  How can I just ignore the HDN_TRACK(begin/end/track) messages?
All I want is to disable the header sizing in my listctrl.

Thanks,
Asaf
---
Asaf Kashi                             kashi@ap.net  kashi@sr.hp.com
Software Development Engineer          internal-hp:  =
http://styx.sr.hp.com/kashi
Hewlett Packard - Santa Rosa Systems Division        =
http://www.ap.net/~kashi

----------
From: 	Cunningham Graham, IK 23
Sent: 	Wednesday, September 25, 1996 11:59 PM
To: 	'mfc-l'
Subject: 	Re: Disabling Column Sizing in CListCtrl

[Mini-digest: 2 responses]

you have to trap the listctrl onnotify message somthing like the code
below

BOOL CExtListCtrl::OnNotify(WPARAM wParam, LPARAM lParam, LRESULT*
pResult)=20
{
	UINT code =3D ((NMHDR*)lParam)->code;
	int nColumn;
	CRect rect;

	switch (code)
	{
		case HDN_ENDTRACKA: //Done this cause winnt always uses a unicode
header ctrl.
		case HDN_ENDTRACKW:
		case HDN_BEGINTRACKA:
		case HDN_BEGINTRACKW:
		case HDN_TRACKA:
		case HDN_TRACKW:
			//do what you want here to handle these events
			break;
		default:
			break;
	}
=09
	return CListCtrl::OnNotify(wParam, lParam, pResult);
}

Graham Cunningham
00 41 31 338 0633

>----------
>From: 	jeff.moss@gtri.gatech.edu[SMTP:jeff.moss@gtri.gatech.edu]
>Sent: 	Dienstag, 24. September 1996 23:19
>To: 	mfc-l@netcom.com
>Subject: 	Disabling Column Sizing in CListCtrl
>
>Environment: VC 4.0, WinNT 3.51
>
>I've tried trapping LVM_SETCOLUMNWIDTH, and the various LVN_* notifiers
>but
>it seems that the actual sizing is done somewhere beyond my control.
>
>The CListCtrl I use is my own derived class and is OWNERDRAW_FIXED.
>
>Has anyone done this successfully?
>
>MOSS, JEFFREY N --- Research Scientist
>ITL/CSITD=20
>Georgia Tech Research Institute
>Georgia Institute of Technology
>Atlanta Georgia, 30332
>
>jeff.moss@gtri.gatech.edu
>
>(404) 894-5959 (voice)
>(404) 894-7080 (fax)
>
>
-----From: Mario Contestabile

BOOL  YourListCtrl::OnNotify(...){

     BOOL bret =3D TRUE;
     if ((NMHDR*)lParam)->code =3D=3D HDN_BEGINTRACK)
         bret =3D FALSE;

    *pResult =3D 0;
    return bret;
}



Si Cruse -- scruse@csfp.co.uk
Tuesday, October 22, 1996

[Mini-digest: 3 responses]

Asaf Kashi wrote:
> 
> I tried using your method and I can verify that I am intercepting the =
> HDN messages in the switch statement.  I want to ignore these message =
> and not let the user resize, so I tried sending a TRUE and then later =
> FALSE(just to see if it changes anything)  Neither one did what I =
> wanted.  How can I just ignore the HDN_TRACK(begin/end/track) messages?
> All I want is to disable the header sizing in my listctrl.
> 
> Thanks,
> Asaf
> ---
> Asaf Kashi                             kashi@ap.net  kashi@sr.hp.com
> Software Development Engineer          internal-hp:  =
> http://styx.sr.hp.com/kashi
> Hewlett Packard - Santa Rosa Systems Division        =
> http://www.ap.net/~kashi
> 
> ----------
> From:   Cunningham Graham, IK 23
> Sent:   Wednesday, September 25, 1996 11:59 PM
> To:     'mfc-l'
> Subject:        Re: Disabling Column Sizing in CListCtrl
> 
> [Mini-digest: 2 responses]
> 
> you have to trap the listctrl onnotify message somthing like the code
> below
> 
> BOOL CExtListCtrl::OnNotify(WPARAM wParam, LPARAM lParam, LRESULT*
> pResult)=20
> {
>         UINT code =3D ((NMHDR*)lParam)->code;
>         int nColumn;
>         CRect rect;
> 
>         switch (code)
>         {
>                 case HDN_ENDTRACKA: //Done this cause winnt always uses a unicode
> header ctrl.
>                 case HDN_ENDTRACKW:
>                 case HDN_BEGINTRACKA:
>                 case HDN_BEGINTRACKW:
>                 case HDN_TRACKA:
>                 case HDN_TRACKW:
>                         //do what you want here to handle these events


To disable tracking return here, WITHOUT calling CListCtrl::OnNotify(wParam, lParam, pResult)


>                         break;
>                 default:
>                         break;
>         }
> =09
>         return CListCtrl::OnNotify(wParam, lParam, pResult);
> }
> 
> Graham Cunningham
> 00 41 31 338 0633
> 
> >----------
> >From:  jeff.moss@gtri.gatech.edu[SMTP:jeff.moss@gtri.gatech.edu]
> >Sent:  Dienstag, 24. September 1996 23:19
> >To:    mfc-l@netcom.com
> >Subject:       Disabling Column Sizing in CListCtrl
> >
> >Environment: VC 4.0, WinNT 3.51
> >
> >I've tried trapping LVM_SETCOLUMNWIDTH, and the various LVN_* notifiers
> >but
> >it seems that the actual sizing is done somewhere beyond my control.
> >
> >The CListCtrl I use is my own derived class and is OWNERDRAW_FIXED.
> >
> >Has anyone done this successfully?
> >
> >MOSS, JEFFREY N --- Research Scientist
> >ITL/CSITD=20
> >Georgia Tech Research Institute
> >Georgia Institute of Technology
> >Atlanta Georgia, 30332
> >
> >jeff.moss@gtri.gatech.edu
> >
> >(404) 894-5959 (voice)
> >(404) 894-7080 (fax)
> >
> >
> -----From: Mario Contestabile
> 
> BOOL  YourListCtrl::OnNotify(...){
> 
>      BOOL bret =3D TRUE;
>      if ((NMHDR*)lParam)->code =3D=3D HDN_BEGINTRACK)
>          bret =3D FALSE;
> 
>     *pResult =3D 0;
>     return bret;
> }

-- 

...A closed mouth gathers no foot...
_____________________________________________________________
Si Cruse
Front Office IT Development, Credit Suisse Financial Products
1 Cabot Square, London E14 4QJ
Phone: +44 171 516 2948			Fax: +44 171 516 2688
mailto:scruse@csfp.co.uk	 http://www.cruse.demon.co.uk
-----From: groftde@ebs.ac.com (Derek F. Groft - UTL)

Try this:
	switch ( ((NMHDR*)lParam)->code )
	{
	case HDN_ENDTRACKA:
	case HDN_ENDTRACKW:
	case HDN_TRACKA:
	case HDN_TRACKW:
	case HDN_BEGINTRACKA:
	case HDN_BEGINTRACKW:
		*pResult = TRUE; // Return TRUE to ignore tracking
		return TRUE;	  // Return TRUE to kill this message

	default:
		break;
	}

	return CListCtrl::OnNotify(wParam, lParam, pResult);

-----From: Asaf Kashi 

Here is my current OnNotify(...):

BOOL CPropertiesListCtrl::OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult) 
{
	UINT code = ((NMHDR*)lParam)->code;

	switch (code)
	{
	case HDN_ENDTRACKA:
	case HDN_ENDTRACKW:
	case HDN_BEGINTRACKA:
	case HDN_BEGINTRACKW:
	case HDN_TRACKA:
	case HDN_TRACKW:
		return TRUE;

	default:
		break;
	}
	return CListCtrl::OnNotify(wParam, lParam, pResult);
}

This does NOT work.  After getting a few responses from the list, it seems that this code should work.  Any ideas?
Asaf
---
Asaf Kashi                             kashi@ap.net  kashi@sr.hp.com
Software Development Engineer          internal-hp:  http://styx.sr.hp.com/kashi
Hewlett Packard - Santa Rosa Systems Division        http://www.ap.net/~kashi




Barry Tannenbaum -- barry@dddv.com
Friday, October 25, 1996

>I tried using your method and I can verify that I am intercepting the =
>HDN messages in the switch statement.  I want to ignore these message =
>and not let the user resize, so I tried sending a TRUE and then later =
>FALSE(just to see if it changes anything)  Neither one did what I =
>wanted.  How can I just ignore the HDN_TRACK(begin/end/track) messages?
>All I want is to disable the header sizing in my listctrl.

I did something similar recently.  I wanted to restrict sizing.  The
following is a snippet from my solution:

    switch (pNotify->hdr.code)
    {
	case HDN_TRACKA:
	case HDN_TRACKW:

            // Make sure that this is the first column

	    if (0 != pNotify->iItem)
		break;

            // If the width is less than we want to allow, force it to the
            // minimum width

	    if (pNotify->pitem->cxy < m_cxMin[0])
		pNotify->pitem->cxy = m_cxMin[0];
	    break;
	}

    // Let the base class do it's thing
	
    return CListCtrl::WindowProc(message, wParam, lParam);

        - Barry

--------------------------------------------------------------------------------

3DV Technology, Inc              Phone: (603) 595-2200 X228
410 Amherst St., Suite 150       Fax:   (603) 595-2228
Nashua, NH  03063                Net:   barry@dddv.com






| Вернуться в корень Архива |