68 lines
1.3 KiB
C++
68 lines
1.3 KiB
C++
// iadlstvr.cpp : implementation file
|
|
//
|
|
|
|
#include "stdafx.h"
|
|
#include "IADLstVr.hpp"
|
|
|
|
#ifdef _DEBUG
|
|
#define new DEBUG_NEW
|
|
#undef THIS_FILE
|
|
static char THIS_FILE[] = __FILE__;
|
|
#endif
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
// IAD_ListVariable
|
|
|
|
IAD_ListVariable::IAD_ListVariable()
|
|
{
|
|
}
|
|
|
|
IAD_ListVariable::~IAD_ListVariable()
|
|
{
|
|
}
|
|
|
|
|
|
BEGIN_MESSAGE_MAP(IAD_ListVariable, CListCtrl)
|
|
//{{AFX_MSG_MAP(IAD_ListVariable)
|
|
ON_WM_KEYDOWN()
|
|
//}}AFX_MSG_MAP
|
|
END_MESSAGE_MAP()
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
// IAD_ListVariable message handlers
|
|
|
|
void IAD_ListVariable::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags)
|
|
{
|
|
if (nChar == VK_DELETE)
|
|
{
|
|
// should delete the current line
|
|
int iItem = m_fn_iGetSelectedItem ();
|
|
|
|
if (iItem != -1)
|
|
DeleteItem (iItem);
|
|
}
|
|
|
|
CListCtrl::OnKeyDown(nChar, nRepCnt, nFlags);
|
|
}
|
|
|
|
int IAD_ListVariable::m_fn_iGetSelectedItem (void)
|
|
{
|
|
int iCount = GetItemCount ();
|
|
int iItem;
|
|
|
|
for (iItem = 0; iItem < iCount; iItem ++)
|
|
{
|
|
LVITEM lvItem;
|
|
lvItem . mask = LVIF_STATE;
|
|
lvItem . stateMask = LVIS_SELECTED | LVIS_FOCUSED;
|
|
lvItem . iItem = iItem;
|
|
lvItem . iSubItem = 0;
|
|
if (GetItem (& lvItem))
|
|
{
|
|
if (lvItem . state & LVIS_FOCUSED)
|
|
return iItem;
|
|
}
|
|
}
|
|
|
|
return -1;
|
|
} |