123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113 |
- // SelectVariantDlg.cpp : implementation file
- //
- #include "stdafx.h"
- #include "icredit.h"
- #include "SelectVariantDlg.h"
- #include "kernel.h"
- #ifdef _DEBUG
- #define new DEBUG_NEW
- #undef THIS_FILE
- static char THIS_FILE[] = __FILE__;
- #endif
- /////////////////////////////////////////////////////////////////////////////
- // CSelectVariantDlg dialog
- CSelectVariantDlg::CSelectVariantDlg(CWnd* pParent /*=NULL*/)
- : CDialog(CSelectVariantDlg::IDD, pParent)
- {
- //{{AFX_DATA_INIT(CSelectVariantDlg)
- // NOTE: the ClassWizard will add member initialization here
- m_nType = 0;
- //}}AFX_DATA_INIT
- }
- void CSelectVariantDlg::DoDataExchange(CDataExchange* pDX)
- {
- CDialog::DoDataExchange(pDX);
- //{{AFX_DATA_MAP(CSelectVariantDlg)
- DDX_Control(pDX, IDC_VARLIST, m_ctrlVariant);
- //}}AFX_DATA_MAP
- }
- BEGIN_MESSAGE_MAP(CSelectVariantDlg, CDialog)
- //{{AFX_MSG_MAP(CSelectVariantDlg)
- ON_NOTIFY(NM_CLICK, IDC_VARLIST, OnClickVarlist)
- //}}AFX_MSG_MAP
- END_MESSAGE_MAP()
- /////////////////////////////////////////////////////////////////////////////
- // CSelectVariantDlg message handlers
- BOOL CSelectVariantDlg::OnInitDialog()
- {
- CDialog::OnInitDialog();
- CString strVar=_T("±äÁ¿");
- CString strDes=_T("ÃèÊö");
- m_ctrlVariant.InsertColumn(0, strVar, LVCFMT_LEFT,
- 95 ,0);
- m_ctrlVariant.InsertColumn(1, strDes, LVCFMT_LEFT,
- 190 ,1);
- if ( m_nType == 1 ) // di
- {
- }
- else if ( m_nType == 0 ) // ai
- {
- int size = pVariantsManager->m_analog.GetSize();
- for ( int i =0; i<size; i++)
- {
- CAnalog* pAnalog = pVariantsManager->m_analog.GetAt(i);
-
- strVar = pAnalog->m_strName;
- strDes = pAnalog->m_strDesc;
- TCHAR buf[200];
- LV_ITEM lvitem;
- int iActualItem;
- lvitem.mask = LVIF_TEXT;
- lvitem.iItem = i ;
- lvitem.iSubItem = 0;
- strncpy (buf, strVar, 100);
- lvitem.pszText = buf;
- iActualItem = m_ctrlVariant.InsertItem(&lvitem); // insert new item
- //________________________________________________________________________________________________
- lvitem.mask = LVIF_TEXT;
- lvitem.iItem = iActualItem;
- lvitem.iSubItem = 1;
- strncpy (buf, strDes, 100);
- lvitem.pszText = buf;
- m_ctrlVariant.SetItem(&lvitem);
- }
- }
- return TRUE;
- }
- void CSelectVariantDlg::OnOK()
- {
- CDialog::OnOK();
- }
- void CSelectVariantDlg::OnClickVarlist(NMHDR* pNMHDR, LRESULT* pResult)
- {
- CPoint point;
- GetCursorPos(&point);
- m_ctrlVariant.ScreenToClient(&point);
- LVHITTESTINFO lvHTI;
- lvHTI.pt.x = point.x;
- lvHTI.pt.y = point.y;
- m_ctrlVariant.SubItemHitTest(&lvHTI);
- int m_nItem = lvHTI.iItem; //ÐкÅ
- char var[100];
- m_ctrlVariant.GetItemText(m_nItem, 0, var, 100);
- m_strVar = var;
- *pResult = 0;
- }
|