home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD2.mdf / c / library / mslang / ript16 / sample / rtabdial.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1994-04-16  |  6.4 KB  |  239 lines

  1. // rtabdial.cpp : implementation file
  2. //
  3.  
  4. #include "stdafx.h"
  5. #include "rtab_sam.h"
  6. #include "..\include\rip_tabs.h"
  7. #include "rtab_doc.h"
  8. #include "rtab_vw.h"
  9. #include "rtabdial.h"
  10.  
  11. #ifdef _DEBUG
  12. #undef THIS_FILE
  13. static char BASED_CODE THIS_FILE[] = __FILE__;
  14. #endif
  15.  
  16. /////////////////////////////////////////////////////////////////////////////
  17. // CRTabDialog dialog
  18.  
  19. CRTabDialog::CRTabDialog(CWnd* pParent /*=NULL*/)
  20.     : CTabDialog(CRTabDialog::IDD, pParent)
  21. {
  22.     //{{AFX_DATA_INIT(CRTabDialog)
  23.         // NOTE: the ClassWizard will add member initialization here
  24.     //}}AFX_DATA_INIT
  25.  
  26.     MyView = (CRtab_samView*)pParent;
  27. }
  28.  
  29. void CRTabDialog::DoDataExchange(CDataExchange* pDX)
  30. {
  31.     CTabDialog::DoDataExchange(pDX);
  32.     //{{AFX_DATA_MAP(CRTabDialog)
  33.         // NOTE: the ClassWizard will add DDX and DDV calls here
  34.     //}}AFX_DATA_MAP
  35. }
  36.  
  37. BEGIN_MESSAGE_MAP(CRTabDialog, CTabDialog)
  38.     //{{AFX_MSG_MAP(CRTabDialog)
  39.     ON_BN_CLICKED(IDHELP, OnClickedHelp)
  40.     //}}AFX_MSG_MAP
  41. END_MESSAGE_MAP()
  42.  
  43. /////////////////////////////////////////////////////////////////////////////
  44. // CRTabDialog message handlers
  45.  
  46. BOOL CRTabDialog::OnInitDialog()
  47. {
  48.   DlgOptionsList[0]= new CPtrArray();
  49.   DlgOptionsList[0]->SetSize(0, 20);
  50.   DlgOptionsList[1]= new CPtrArray();
  51.   DlgOptionsList[1]->SetSize(0, 20);
  52.  
  53.   
  54.     // mode info was here
  55.     DlgOptionsList[0]->Add((void*)CStringPtr("Radio Buttons"));
  56.     DlgOptionsList[0]->Add((void*)CStringPtr("Check Boxes"));
  57.     DlgOptionsList[0]->Add((void*)CStringPtr("Edit Control"));
  58.     DlgOptionsList[0]->Add((void*)CStringPtr("File Browse"));
  59.     DlgOptionsList[0]->Add((void*)CStringPtr("List Box"));
  60.     DlgOptionsList[0]->Add((void*)CStringPtr("About..."));
  61.                                 
  62.     DlgOptionsList[1]->Add((void*)CStringPtr("RADIO_DIALOG"));
  63.     DlgOptionsList[1]->Add((void*)CStringPtr("CHECK_DIALOG"));
  64.     DlgOptionsList[1]->Add((void*)CStringPtr("EDIT_DIALOG"));
  65.     DlgOptionsList[1]->Add((void*)CStringPtr("FILE_DIALOG"));
  66.     DlgOptionsList[1]->Add((void*)CStringPtr("LIST_DIALOG"));
  67.     DlgOptionsList[1]->Add((void*)CStringPtr("ABOUT_DIALOG"));
  68.     
  69.  
  70.     CTabDialog::InitData(DlgOptionsList[0], DlgOptionsList[1], IDC_RSTATIC);
  71.  
  72.     CTabDialog::OnInitDialog();
  73.     
  74.     // place your own controls intialization code here ...    
  75.     // (*after* calling CTabDialog::InitData & OnInitDialog)  
  76.     
  77.     SendDlgItemMessage(IDC_LIST1, LB_ADDSTRING, 0, (LONG)"Item 1");
  78.     SendDlgItemMessage(IDC_LIST1, LB_ADDSTRING, 0, (LONG)"Item 2");
  79.     SendDlgItemMessage(IDC_LIST1, LB_ADDSTRING, 0, (LONG)"Item 3");
  80.     SendDlgItemMessage(IDC_LIST1, LB_ADDSTRING, 0, (LONG)"Item 4");
  81.     
  82.     // return *0* if you want the focus set to the control
  83.     // that RipTABS has selected.  (Recommended)
  84.     return 0;  
  85. }
  86.  
  87. void CRTabDialog::OnOK()
  88. {
  89.     char str[101];
  90.     CString CheckBoxStatus, RadioButtonStatus, EditControlStatus;
  91.  
  92.     if(IsDlgButtonChecked(IDC_CHECK1))
  93.         MyView->CheckBoxStatus = "1";
  94.     if(IsDlgButtonChecked(IDC_CHECK2))
  95.         MyView->CheckBoxStatus = "2";
  96.     if(IsDlgButtonChecked(IDC_CHECK3))
  97.         MyView->CheckBoxStatus = "3";
  98.  
  99.     if(IsDlgButtonChecked(IDC_RADIO1))
  100.         MyView->RadioButtonStatus = "1";
  101.     if(IsDlgButtonChecked(IDC_RADIO2))
  102.         MyView->RadioButtonStatus = "2";
  103.     if(IsDlgButtonChecked(IDC_RADIO3))
  104.         MyView->RadioButtonStatus = "3";
  105.     
  106.     GetDlgItemText(IDC_EDITBOX, str, 100);
  107.     MyView->EditControlStatus = str;
  108.  
  109.     CTabDialog::OnOK();
  110. }
  111.  
  112. void CRTabDialog::OnClickedHelp()
  113. {
  114.     CString MessageText="Display Help For : ";
  115.     MessageText+=ActivePage;
  116.     MessageBox(MessageText, "RipTABS Sample");
  117. }
  118.  
  119. void CRTabDialog::OnCancel()
  120. {
  121.     // TODO: Add extra cleanup here
  122.     
  123.     CTabDialog::OnCancel();
  124. }
  125.  
  126. void CRTabDialog::SwitchToNotification(int TabIndex, CString* TabName)
  127. {
  128.     ActivePage= *TabName;
  129. }
  130.  
  131.  
  132. /////////////////////////////////////////////////////////////////////////////
  133. // CRTabMDialog MODELESS dialog
  134.  
  135. CRTabMDialog::CRTabMDialog(CWnd* pParent /*=NULL*/)
  136.     : CTabDialog()
  137. {
  138.     //{{AFX_DATA_INIT(CRTabDialog)
  139.         // NOTE: the ClassWizard will add member initialization here
  140.     //}}AFX_DATA_INIT
  141.  
  142.     MyView = (CRtab_samView*)pParent;
  143.     Create(CRTabMDialog::IDD, pParent);
  144. }
  145.  
  146. void CRTabMDialog::DoDataExchange(CDataExchange* pDX)
  147. {
  148.     CTabDialog::DoDataExchange(pDX);
  149.     //{{AFX_DATA_MAP(CRTabDialog)
  150.         // NOTE: the ClassWizard will add DDX and DDV calls here
  151.     //}}AFX_DATA_MAP
  152. }
  153.  
  154. BEGIN_MESSAGE_MAP(CRTabMDialog, CTabDialog)
  155.     //{{AFX_MSG_MAP(CRTabDialog)
  156.     ON_BN_CLICKED(IDHELP, OnClickedHelp)
  157.     //}}AFX_MSG_MAP
  158. END_MESSAGE_MAP()
  159.  
  160. /////////////////////////////////////////////////////////////////////////////
  161. // CRTabDialog message handlers
  162.  
  163. BOOL CRTabMDialog::OnInitDialog()
  164. {
  165.   DlgOptionsList[0]= new CPtrArray();
  166.   DlgOptionsList[0]->SetSize(0, 20);
  167.   DlgOptionsList[1]= new CPtrArray();
  168.   DlgOptionsList[1]->SetSize(0, 20);
  169.  
  170.   
  171.     // mode info was here
  172.     DlgOptionsList[0]->Add((void*)CStringPtr("Radio Buttons"));
  173.     DlgOptionsList[0]->Add((void*)CStringPtr("Check Boxes"));
  174.     DlgOptionsList[0]->Add((void*)CStringPtr("Edit Control"));
  175.                                 
  176.     DlgOptionsList[1]->Add((void*)CStringPtr("RADIO_DIALOG"));
  177.     DlgOptionsList[1]->Add((void*)CStringPtr("CHECK_DIALOG"));
  178.     DlgOptionsList[1]->Add((void*)CStringPtr("EDIT_DIALOG"));
  179.     
  180.  
  181.     CTabDialog::InitData(DlgOptionsList[0], DlgOptionsList[1], IDC_RSTATIC);
  182.  
  183.     CTabDialog::OnInitDialog();
  184.     
  185.     // place your own controls intialization code here ...    
  186.     // (*after* calling CTabDialog::InitData & OnInitDialog)
  187.     
  188.     return TRUE;  // return TRUE  unless you set the focus to a control
  189. }
  190.  
  191. void CRTabMDialog::OnOK()
  192. {
  193.     char str[101];
  194.     CString CheckBoxStatus, RadioButtonStatus, EditControlStatus;
  195.  
  196.     if(IsDlgButtonChecked(IDC_CHECK1))
  197.         MyView->CheckBoxStatus = "1";
  198.     if(IsDlgButtonChecked(IDC_CHECK2))
  199.         MyView->CheckBoxStatus = "2";
  200.     if(IsDlgButtonChecked(IDC_CHECK3))
  201.         MyView->CheckBoxStatus = "3";
  202.  
  203.     if(IsDlgButtonChecked(IDC_RADIO1))
  204.         MyView->RadioButtonStatus = "1";
  205.     if(IsDlgButtonChecked(IDC_RADIO2))
  206.         MyView->RadioButtonStatus = "2";
  207.     if(IsDlgButtonChecked(IDC_RADIO3))
  208.         MyView->RadioButtonStatus = "3";
  209.     
  210.     GetDlgItemText(IDC_EDITBOX, str, 100);
  211.     MyView->EditControlStatus = str;
  212.  
  213.     CTabDialog::OnOK();
  214. }
  215.  
  216. void CRTabMDialog::OnClickedHelp()
  217. {
  218.     CString MessageText="Display Help For : ";
  219.     MessageText+=ActivePage;
  220.     MessageBox(MessageText, "RipTABS Sample");
  221. }
  222.  
  223. void CRTabMDialog::OnCancel()
  224. {
  225.     // TODO: Add extra cleanup here
  226.     
  227.     CTabDialog::OnCancel();
  228. }
  229.  
  230. void CRTabMDialog::SwitchToNotification(int TabIndex, CString* TabName)
  231. {
  232.     ActivePage= *TabName;
  233. }
  234.                                     
  235. void CRTabMDialog::PostNcDestroy()
  236. {
  237.     delete this;
  238. }
  239.