SelDress.cpp 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. // SelDress.cpp : implementation file
  2. //
  3. #include "stdafx.h"
  4. #include "ylgl.h"
  5. #include "SelDress.h"
  6. #ifdef _DEBUG
  7. #define new DEBUG_NEW
  8. #undef THIS_FILE
  9. static char THIS_FILE[] = __FILE__;
  10. #endif
  11. /////////////////////////////////////////////////////////////////////////////
  12. // SelDress dialog
  13. SelDress::SelDress(CWnd* pParent /*=NULL*/)
  14. : CDialog(SelDress::IDD, pParent)
  15. {
  16. //{{AFX_DATA_INIT(SelDress)
  17. //}}AFX_DATA_INIT
  18. }
  19. void SelDress::DoDataExchange(CDataExchange* pDX)
  20. {
  21. CDialog::DoDataExchange(pDX);
  22. //{{AFX_DATA_MAP(SelDress)
  23. DDX_Control(pDX, IDC_LIST2, m_List2);
  24. DDX_Control(pDX, IDC_LIST1, m_List1);
  25. //}}AFX_DATA_MAP
  26. }
  27. BEGIN_MESSAGE_MAP(SelDress, CDialog)
  28. //{{AFX_MSG_MAP(SelDress)
  29. ON_BN_CLICKED(IDC_BUTTON1, OnButton1)
  30. ON_BN_CLICKED(IDC_BUTTON2, OnButton2)
  31. //}}AFX_MSG_MAP
  32. END_MESSAGE_MAP()
  33. /////////////////////////////////////////////////////////////////////////////
  34. // SelDress message handlers
  35. BOOL SelDress::OnInitDialog()
  36. {
  37. CDialog::OnInitDialog();
  38. // TODO: Add extra initialization here
  39. g_sendhead.bsql=0;
  40. g_sendhead.code[0]=72;
  41. g_sendhead.tabcount=1;
  42. g_pMainWnd->ProcessChatMessageRequest2(0);
  43. if(g_bSendOK==0)
  44. {
  45. CDialog::OnCancel ();
  46. return 0;
  47. }
  48. DataToArray(&m_List1array);
  49. m_List1.ResetContent ();
  50. for(int i=0; i<m_List1array.GetSize (); i++)
  51. {
  52. if(m_List1.GetCount()%2)
  53. m_List1.AddEntry( m_List1array.ElementAt (i).ElementAt (2) , g_gridcol1, m_List1.GetCount());
  54. else
  55. m_List1.AddEntry( m_List1array.ElementAt (i).ElementAt (2) , g_gridcol2, m_List1.GetCount());
  56. }
  57. m_List1.Invalidate ();
  58. if(m_sel.IsEmpty ()==0)
  59. {
  60. int pos=m_sel.Find (";");
  61. while(pos!=-1)
  62. {
  63. m_List2.AddString (m_sel.Left (pos));
  64. m_sel=m_sel.Right (m_sel.GetLength ()-pos-1);
  65. pos=m_sel.Find (";");
  66. }
  67. m_List2.AddString (m_sel);
  68. }
  69. return TRUE; // return TRUE unless you set the focus to a control
  70. // EXCEPTION: OCX Property Pages should return FALSE
  71. }
  72. void SelDress::OnButton1()
  73. {
  74. // TODO: Add your control notification handler code here
  75. CString str;
  76. int pos=m_List1.GetCurSel ();
  77. if(pos==-1)return;
  78. m_List1.GetText (pos, str);
  79. CString str2;
  80. for(int i=0; i<m_List2.GetCount (); i++)
  81. {
  82. m_List2.GetText (i, str2);
  83. if(str==str2)return;
  84. }
  85. m_List2.AddString (str);
  86. }
  87. void SelDress::OnButton2()
  88. {
  89. // TODO: Add your control notification handler code here
  90. CString str;
  91. int pos=m_List2.GetCurSel ();
  92. if(pos==-1)return;
  93. m_List2.DeleteString (pos);
  94. }
  95. void SelDress::OnOK()
  96. {
  97. // TODO: Add extra validation here
  98. m_sel.Empty ();
  99. CString str;
  100. for(int i=0; i<m_List2.GetCount (); i++)
  101. {
  102. m_List2.GetText (i, str);
  103. m_sel+=str;
  104. m_sel+=";";
  105. }
  106. m_sel.TrimRight (";");
  107. CDialog::OnOK();
  108. }