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

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


CListView columns

John Roberts -- jroberts@neutrino.phys.laurentian.ca
Monday, January 20, 1997

Environment: Windows 95, Windows NT 3.51, VC++ 4.0

Hi there, has anybody had any luck preventing users from resizing columns in
a ListView control?

Any advice would be appreciated.

Cheers, John




John Roberts -- jroberts@neutrino.phys.laurentian.ca
Monday, January 20, 1997

Environment: Windows 95, Windows NT 3.51, VC++ 4.0

Hi there, has anybody had any luck preventing users from resizing columns in
a ListView control?

Any advice would be appreciated.

Cheers, John




Mike Blaszczak -- mikeblas@nwlink.com
Wednesday, January 22, 1997

[Mini-digest: 7 responses]

At 23:43 1/20/97 -0500, John Roberts wrote:
>Environment: Windows 95, Windows NT 3.51, VC++ 4.0

>Hi there, has anybody had any luck preventing users from resizing columns in
>a ListView control?

>Any advice would be appreciated.

This came up within the last week or two right here.  You need to:

1) dynamically subclass the header control in the list box
2) when you get HDN_BEGINTRACK notifications, return FALSE
3) let everything else pass

and that's it.


.B ekiM
http://www.nwlink.com/~mikeblas/
Why does the "new" Corvette look like a 1993 RX-7?
These words are my own. I do not speak on behalf of Microsoft.

-----From: Lubimov Alexey 

Catch notification message(s) from header control, which is a child
window of the listview.

Notification is HDN_BEGINDRAG; it send each time user start dragging the
column to resize it. The return value for this notification tells the
header whether you allow it to resize this specific column.

Hope this helps,

Alex


>-----Original Message-----
>From:	jroberts@neutrino.phys.laurentian.ca
>[SMTP:jroberts@neutrino.phys.laurentian.ca]
>Sent:	Tuesday, January 21, 1997 7:44 AM
>To:	mfc-l@netcom.com
>Subject:	CListView columns
>
>Environment: Windows 95, Windows NT 3.51, VC++ 4.0
>
>Hi there, has anybody had any luck preventing users from resizing columns in
>a ListView control?
>
>Any advice would be appreciated.
>
>Cheers, John
>
-----From: "Michael J. Morel" 

This message is from an earlier discussion on this list.  I have not tried 
to do this, so I cannot guarantee they are correct, but they are worth a 
look.

Mike Morel
mmorel@mushroomsoft.com
Mushroom Software
Home of MFC For Yourself
http://www.mushroomsoft.com

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;
}

----------
From: 	John Roberts[SMTP:jroberts@neutrino.phys.laurentian.ca]
Sent: 	Monday, January 20, 1997 6:43 PM
To: 	mfc-l@netcom.com
Subject: 	CListView columns

Environment: Windows 95, Windows NT 3.51, VC++ 4.0

Hi there, has anybody had any luck preventing users from resizing columns 
in
a ListView control?

Any advice would be appreciated.

Cheers, John






-----From: Santosh Gadre 

Hi John,

Please try using the LVS_NOCOLUMNHEADER
style while calling the create member function of the CListCtrl object.
This will remove the column headers from the listcontrol and won't allow users to resize the columns.
if you need the Column headers and still want to prevent the column sizing then I'm sorry I don't know how to do that.
I will also be interested in knowing that.

Warm regards,
-SanyG

----------
From: 	John Roberts[SMTP:jroberts@neutrino.phys.laurentian.ca]
Sent: 	Tuesday, January 21, 1997 5:13 AM
To: 	mfc-l@netcom.com
Subject: 	CListView columns

Environment: Windows 95, Windows NT 3.51, VC++ 4.0

Hi there, has anybody had any luck preventing users from resizing columns in
a ListView control?

Any advice would be appreciated.

Cheers, John



-----From: jroberts@neutrino.phys.laurentian.ca (John Roberts)

Environment: VC++ 4.0, NT 3.51, Windows 95

In my last post, I asked about CListView column resizing.  What I really meant
to ask about was CListCtrl column resizing.  Sorry about any confusion.

Cheers, John

-----From: "Kenneth A. Argo" 

Handle the WM_NCHITTEST message for the ListCtrl, make the appropriate =
checks and if the user is where you do not want to be, return NC_ERROR;

I have not done this particular thing, but did something similar to =
prevent user selection in the listCtrl.

Ken


----------
From:  John Roberts[SMTP:jroberts@neutrino.phys.laurentian.ca]
Sent:  Monday, January 20, 1997 11:44 PM
To:  mfc-l@netcom.com
Subject:  CListView columns

Environment: Windows 95, Windows NT 3.51, VC++ 4.0

Hi there, has anybody had any luck preventing users from resizing =
columns in
a ListView control?

Any advice would be appreciated.

Cheers, John



-----From: Eric Haddan 


John,

This code works for me:

BOOL CMyListCtrl::OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult) 
{
    HD_NOTIFY	*pHDN = (HD_NOTIFY*)lParam;

    switch (pHDN->hdr.code)
    {
        case HDN_BEGINTRACKW:
        case HDN_BEGINTRACK:
            *pResult = TRUE;    // TRUE disables tracking
            return TRUE;           // Processed message
    }

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

Eric


----------
From: 	John Roberts[SMTP:jroberts@neutrino.phys.laurentian.ca]
Sent: 	Monday, January 20, 1997 8:43 PM
To: 	mfc-l@netcom.com
Subject: 	CListView columns

Environment: Windows 95, Windows NT 3.51, VC++ 4.0

Hi there, has anybody had any luck preventing users from resizing columns in
a ListView control?

Any advice would be appreciated.

Cheers, John





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