123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140 |
- // SPBox.cpp : implementation file
- //
- #include "stdafx.h"
- #include "LYFZIPManage.h"
- #include "SPBox.h"
- #ifdef _DEBUG
- #define new DEBUG_NEW
- #undef THIS_FILE
- static char THIS_FILE[] = __FILE__;
- #endif
- /////////////////////////////////////////////////////////////////////////////
- // SPBox dialog
- SPBox::SPBox(CWnd* pParent /*=NULL*/)
- : CDialog(SPBox::IDD, pParent)
- {
- //{{AFX_DATA_INIT(SPBox)
- // NOTE: the ClassWizard will add member initialization here
- //}}AFX_DATA_INIT
- m_mode=0;
- }
- void SPBox::DoDataExchange(CDataExchange* pDX)
- {
- CDialog::DoDataExchange(pDX);
- //{{AFX_DATA_MAP(SPBox)
- DDX_Control(pDX, IDC_LIST2, m_List1);
- DDX_Control(pDX, IDC_COMBOsplb, m_combosplb);
- //}}AFX_DATA_MAP
- }
- BEGIN_MESSAGE_MAP(SPBox, CDialog)
- //{{AFX_MSG_MAP(SPBox)
- ON_CBN_SELCHANGE(IDC_COMBOsplb, OnSelchangeCOMBOsplb)
- ON_NOTIFY(NM_DBLCLK, IDC_LIST2, OnDblclkList2)
- //}}AFX_MSG_MAP
- END_MESSAGE_MAP()
- /////////////////////////////////////////////////////////////////////////////
- // SPBox message handlers
- BOOL SPBox::OnInitDialog()
- {
- CDialog::OnInitDialog();
-
- // TODO: Add extra initialization here
- m_List1.SetHeadings( "编号,50;商品名称,150;销售价,80" );
- m_List1.LoadColumnInfo (103);
- g_sendhead.bsql=0;
- g_sendhead.code[0]=8;
- g_sendhead.code[1]=2;
- g_sendhead.tabcount=2;
- g_pMainWnd->ProcessChatMessageRequest2(2);if(g_bSendOK==0)return 1;
- DataToArray(&m_List1array,&m_List2array);
- for(int i=0; i<m_List2array.GetSize (); i++)
- m_combosplb.AddString (m_List2array.ElementAt (i).ElementAt (0));
-
- if(m_combosplb.GetCount ())
- m_combosplb.SetCurSel (0);
- OnSelchangeCOMBOsplb();
- this->CenterWindow (g_pMainWnd);
- m_combosplb.SetFocus();
- return false; // return TRUE unless you set the focus to a control
- // EXCEPTION: OCX Property Pages should return FALSE
- }
- void SPBox::OnCancel()
- {
- // TODO: Add extra cleanup here
-
- CDialog::OnCancel();
- }
- void SPBox::OnOK()
- {
- // TODO: Add extra validation here
- if(m_mode==0)
- {
- POSITION pos;
- pos=m_List1.GetFirstSelectedItemPosition();
- if(pos==NULL)
- {
- AfxMessageBox("请先选中一个商品!");
- return;
- }
- int iItem=m_List1.GetNextSelectedItem(pos);
- m_spid=m_List1.GetItemText (iItem, 0);
- m_spname=m_List1.GetItemText (iItem, 1);
- }
- CDialog::OnOK();
- }
- void SPBox::OnSelchangeCOMBOsplb()
- {
- // TODO: Add your control notification handler code here
- int pos=m_combosplb.GetCurSel ();
- if(pos==-1)return;
- CString str;
- m_combosplb.GetLBText (pos, str);
- FillGrid(str);
- }
- void SPBox::FillGrid(CString str)
- {
- m_List1.DeleteAllItems2 ();
- int ii=0;
- m_List1.m_arLabels.SetSize( m_List1array.GetSize (), 1 );
- int count=0;
- for(ii=0; ii<m_List1.m_arLabels.GetSize (); ii++)
- {
- if(m_List1array.ElementAt (ii).ElementAt (3)==str)
- {
- m_List1.m_arLabels.ElementAt (count++).Copy (m_List1array.ElementAt (ii));
- }
- }
- m_List1.m_arLabels.SetSize(count, 1);
- ii=count;
- m_List1.m_LabelCount=ii;
- m_List1.SetItemCountEx (ii);
- }
- void SPBox::OnDblclkList2(NMHDR* pNMHDR, LRESULT* pResult)
- {
- // TODO: Add your control notification handler code here
- OnOK();
- *pResult = 0;
- }
|