/[H6]/EquipmentEditDialog.cpp
ViewVC logotype

Annotation of /EquipmentEditDialog.cpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 31 - (hide annotations) (download)
Sun Sep 3 10:10:19 2006 UTC (17 years, 6 months ago) by torben
File size: 2339 byte(s)
Added author/developer comments
1 torben 31 /*
2     * Developed by Torben H. Nielsen
3     */
4 torben 9
5     #include "stdafx.h"
6     #include "h6-udlånssystem.h"
7     #include "EquipmentEditDialog.h"
8     #include ".\equipmenteditdialog.h"
9    
10    
11     // EquipmentEditDialog dialog
12    
13     IMPLEMENT_DYNAMIC(EquipmentEditDialog, CDialog)
14     EquipmentEditDialog::EquipmentEditDialog(CWnd* pParent /*=NULL*/)
15     : CDialog(EquipmentEditDialog::IDD, pParent)
16     {
17     }
18    
19     EquipmentEditDialog::~EquipmentEditDialog()
20     {
21     }
22    
23     void EquipmentEditDialog::DoDataExchange(CDataExchange* pDX)
24     {
25     CDialog::DoDataExchange(pDX);
26     }
27    
28    
29     BEGIN_MESSAGE_MAP(EquipmentEditDialog, CDialog)
30     ON_BN_CLICKED(IDOK, OnBnClickedOk)
31     END_MESSAGE_MAP()
32    
33    
34     // EquipmentEditDialog message handlers
35    
36     void EquipmentEditDialog::OnBnClickedOk()
37     {
38     CString barcode,name,placement,description;
39    
40     GetDlgItem(IDC_BARCODE)->GetWindowText(barcode);
41     GetDlgItem(IDC_NAME)->GetWindowText(name);
42     GetDlgItem(IDC_PLACEMENT)->GetWindowText(placement);
43     GetDlgItem(IDC_DESCRIPTION)->GetWindowText(description);
44    
45     //If the barcode is EAN-13 maybe we should check for a valid barcode??
46     if (barcode.GetLength() != 13) {
47     MessageBox("Barcode must be 13 characters long");
48     return;
49     }
50    
51     if (name == "") {
52     MessageBox("You must enter a name");
53     return;
54     }
55    
56     if (placement == "") {
57     MessageBox("You must enter a placement");
58     return;
59     }
60    
61     m_currentEquipment.barcode = barcode;
62     m_currentEquipment.description = description;
63     m_currentEquipment.name = name;
64     m_currentEquipment.placement = placement;
65     // TODO: Add your control notification handler code here
66     OnOK();
67     }
68    
69     BOOL EquipmentEditDialog::OnInitDialog()
70     {
71     CDialog::OnInitDialog();
72    
73     ((CEdit*)GetDlgItem(IDC_BARCODE))->SetLimitText(13);
74     ((CEdit*)GetDlgItem(IDC_NAME))->SetLimitText(20);
75     ((CEdit*)GetDlgItem(IDC_DESCRIPTION))->SetLimitText(200);
76     ((CEdit*)GetDlgItem(IDC_PLACEMENT))->SetLimitText(20);
77    
78     if (m_currentEquipment.barcode != "") {
79     GetDlgItem(IDC_BARCODE)->SetWindowText(m_currentEquipment.barcode);
80     GetDlgItem(IDC_NAME)->SetWindowText(m_currentEquipment.name);
81     GetDlgItem(IDC_DESCRIPTION)->SetWindowText(m_currentEquipment.description);
82     GetDlgItem(IDC_PLACEMENT)->SetWindowText(m_currentEquipment.placement);
83 torben 11 ((CEdit*)GetDlgItem(IDC_BARCODE))->SetReadOnly(true);
84 torben 9 }
85    
86     return TRUE; // return TRUE unless you set the focus to a control
87     }

  ViewVC Help
Powered by ViewVC 1.1.20