123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125 |
- // SelDress.cpp : implementation file
- //
- #include "stdafx.h"
- #include "ylgl.h"
- #include "SelDress.h"
- #ifdef _DEBUG
- #define new DEBUG_NEW
- #undef THIS_FILE
- static char THIS_FILE[] = __FILE__;
- #endif
- /////////////////////////////////////////////////////////////////////////////
- // SelDress dialog
- SelDress::SelDress(CWnd* pParent /*=NULL*/)
- : CDialog(SelDress::IDD, pParent)
- {
- //{{AFX_DATA_INIT(SelDress)
- //}}AFX_DATA_INIT
- }
- void SelDress::DoDataExchange(CDataExchange* pDX)
- {
- CDialog::DoDataExchange(pDX);
- //{{AFX_DATA_MAP(SelDress)
- DDX_Control(pDX, IDC_LIST2, m_List2);
- DDX_Control(pDX, IDC_LIST1, m_List1);
- //}}AFX_DATA_MAP
- }
- BEGIN_MESSAGE_MAP(SelDress, CDialog)
- //{{AFX_MSG_MAP(SelDress)
- ON_BN_CLICKED(IDC_BUTTON1, OnButton1)
- ON_BN_CLICKED(IDC_BUTTON2, OnButton2)
- //}}AFX_MSG_MAP
- END_MESSAGE_MAP()
- /////////////////////////////////////////////////////////////////////////////
- // SelDress message handlers
- BOOL SelDress::OnInitDialog()
- {
- CDialog::OnInitDialog();
-
- // TODO: Add extra initialization here
- g_sendhead.bsql=0;
- g_sendhead.code[0]=72;
- g_sendhead.tabcount=1;
- g_pMainWnd->ProcessChatMessageRequest2(0);
- if(g_bSendOK==0)
- {
- CDialog::OnCancel ();
- return 0;
- }
- DataToArray(&m_List1array);
- m_List1.ResetContent ();
- for(int i=0; i<m_List1array.GetSize (); i++)
- {
- if(m_List1.GetCount()%2)
- m_List1.AddEntry( m_List1array.ElementAt (i).ElementAt (2) , g_gridcol1, m_List1.GetCount());
- else
- m_List1.AddEntry( m_List1array.ElementAt (i).ElementAt (2) , g_gridcol2, m_List1.GetCount());
- }
- m_List1.Invalidate ();
- if(m_sel.IsEmpty ()==0)
- {
- int pos=m_sel.Find (";");
- while(pos!=-1)
- {
- m_List2.AddString (m_sel.Left (pos));
- m_sel=m_sel.Right (m_sel.GetLength ()-pos-1);
- pos=m_sel.Find (";");
- }
- m_List2.AddString (m_sel);
- }
- return TRUE; // return TRUE unless you set the focus to a control
- // EXCEPTION: OCX Property Pages should return FALSE
- }
- void SelDress::OnButton1()
- {
- // TODO: Add your control notification handler code here
- CString str;
- int pos=m_List1.GetCurSel ();
- if(pos==-1)return;
- m_List1.GetText (pos, str);
- CString str2;
- for(int i=0; i<m_List2.GetCount (); i++)
- {
- m_List2.GetText (i, str2);
- if(str==str2)return;
-
- }
- m_List2.AddString (str);
- }
- void SelDress::OnButton2()
- {
- // TODO: Add your control notification handler code here
- CString str;
- int pos=m_List2.GetCurSel ();
- if(pos==-1)return;
- m_List2.DeleteString (pos);
- }
- void SelDress::OnOK()
- {
- // TODO: Add extra validation here
- m_sel.Empty ();
- CString str;
- for(int i=0; i<m_List2.GetCount (); i++)
- {
- m_List2.GetText (i, str);
- m_sel+=str;
- m_sel+=";";
- }
- m_sel.TrimRight (";");
- CDialog::OnOK();
- }
|