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

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


CListCtrl drag and drop, detecting which column is being dra

Luke Stephens -- luker@tfs.net
Monday, September 30, 1996

Environment: VC++ 4.2, Win95, NT 3.51, NT 4.0

How can you determine which column is being dragged in a CListCtrl?  
I'm using the control in report view and I wan't to be able to drag and
drop from one column to another within the same or different rows. 
 
Any ideas?
 
Luke Stephens
 
luker@tfs.net
 



Luke Stephens -- luker@tfs.net
Wednesday, October 02, 1996

FYI: I solved my own problem. After searching the Commctrl.h header 
file (VC 4.2), I discovered that a new item was added to the
LV_HITTESTTINFO 
structure. Here's the new structure:

typedef struct tagLVHITTESTINFO
{
  POINT pt;
  UINT flags;
  int iItem;
-->  int iSubItem; // this is was NOT in win95.  valid only for
LVM_SUBITEMHITTEST
} LVHITTESTINFO, FAR* LPLVHITTESTINFO;

It appears that a new undocumented message (LVM_SUBITEMHITTEST) was added
to control, but not implemented in CListCtrl.
So, I used the following code to determine which column was clicked:

LV_HITTESTINFO hit;
GetCursorPos(&hit.pt);
m_List.ScreenToClient(&hit.pt);
	
::SendMessage(m_List.m_hWnd, LVM_SUBITEMHITTEST, 0, (LPARAM)(LV_HITTESTINFO
FAR*)(&hit));
TRACE2("Item: %d, SubItem: %d\n",hit.iItem,hit.iSubItem);


----------
> From: Luke Stephens 
> To: 'mfc-l@netcom.com'
> Subject: CListCtrl drag and drop, detecting which column is being dragged
> Date: Monday, September 30, 1996 6:10 PM
> 
> Environment: VC++ 4.2, Win95, NT 3.51, NT 4.0
> 
> How can you determine which column is being dragged in a CListCtrl?  
> I'm using the control in report view and I wan't to be able to drag and
> drop from one column to another within the same or different rows. 
>  
> Any ideas?
>  
> Luke Stephens
>  
> luker@tfs.net
>  




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