// SPBox.cpp : implementation file // #include "stdafx.h" #include "ylgl.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) m_filter = _T(""); //}}AFX_DATA_INIT m_mode=0; m_badmin=0; } void SPBox::DoDataExchange(CDataExchange* pDX) { CDialog::DoDataExchange(pDX); //{{AFX_DATA_MAP(SPBox) DDX_Control(pDX, IDC_LIST1, m_listbox1); DDX_Control(pDX, IDC_LIST2, m_List1); DDX_Control(pDX, IDC_COMBOsplb, m_combosplb); DDX_Text(pDX, IDC_EDIT1, m_filter); //}}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) ON_BN_CLICKED(IDC_BUTTON1, OnButton1) ON_BN_CLICKED(IDC_BUTTON2, OnButton2) ON_BN_CLICKED(IDC_BUTTON3, OnButton3) //}}AFX_MSG_MAP END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // SPBox message handlers BOOL SPBox::OnInitDialog() { CDialog::OnInitDialog(); // TODO: Add extra initialization here // m_badmin=IsHasRights2new(49); if(m_badmin) m_List1.SetHeadings( "编号,50;商品名称,150;成本价,80;销售价,80" ); else m_List1.SetHeadings( "编号,50;商品名称,150;销售价,80" ); m_List1.LoadColumnInfo (103); CString filter="hide<>'下架' or hide is null;"; g_sendhead.bsql=0; g_sendhead.code[0]=8; g_sendhead.code[1]=2; g_sendhead.tabcount=2; g_pMainWnd->ProcessChatMessageRequest2(filter);if(g_bSendOK==0)return 1; DataToArray(&m_List1array,&m_List2array); CString strRes1; if(m_badmin==0) { for(int i=0; iCenterWindow (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 /* int pos=m_combosplb.GetCurSel (); if(pos==-1)return; m_combosplb.GetLBText (pos, m_lb);*/ //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) { UpdateData(); m_filter.MakeUpper (); if(m_filter!="")m_combosplb.SetCurSel (-1); m_List1.DeleteAllItems2 (); int ii=0; m_List1.m_arLabels.SetSize( m_List1array.GetSize (), 1 ); int count=0; if(m_badmin) { if(m_filter=="") { for(ii=0; ii