0028892: BOPAlgo_PaveFiller returns status "error: 11" in draw or raises exception...
[occt.git] / samples / mfc / standard / 06_Ocaf / src / NewBoxDlg.cpp
1 // NewBoxDlg.cpp : implementation file
2 //
3
4 #include "stdafx.h"
5
6 #include "NewBoxDlg.h"
7
8 //#include "OcafApp.h"
9
10 /////////////////////////////////////////////////////////////////////////////
11 // CNewBoxDlg dialog
12
13 CNewBoxDlg::CNewBoxDlg(CWnd* pParent /*=NULL*/)
14         : CDialog(CNewBoxDlg::IDD, pParent)
15 {
16         //{{AFX_DATA_INIT(CNewBoxDlg)
17         m_h = 10.0;
18         m_l = 15.0;
19         m_Name = _T("Box");
20         m_w = 10.0;
21         m_x = 0.0;
22         m_y = 0.0;
23         m_z = 0.0;
24         //}}AFX_DATA_INIT
25 }
26
27 void CNewBoxDlg::DoDataExchange(CDataExchange* pDX)
28 {
29         CDialog::DoDataExchange(pDX);
30         //{{AFX_DATA_MAP(CNewBoxDlg)
31         DDX_Text(pDX, IDC_H, m_h);
32         DDX_Text(pDX, IDC_L, m_l);
33         DDX_Text(pDX, IDC_NAME, m_Name);
34         DDX_Text(pDX, IDC_W, m_w);
35         DDX_Text(pDX, IDC_X, m_x);
36         DDX_Text(pDX, IDC_Y, m_y);
37         DDX_Text(pDX, IDC_Z, m_z);
38         //}}AFX_DATA_MAP
39 }
40
41
42 BEGIN_MESSAGE_MAP(CNewBoxDlg, CDialog)
43         //{{AFX_MSG_MAP(CNewBoxDlg)
44         //}}AFX_MSG_MAP
45 END_MESSAGE_MAP()
46
47 /////////////////////////////////////////////////////////////////////////////
48 // CNewBoxDlg message handlers
49
50 void CNewBoxDlg::OnOK() 
51 {
52         UpdateData(TRUE);
53         if( (m_h<=Precision::Confusion()) || (m_l<=Precision::Confusion()) || (m_w<=Precision::Confusion()) )
54         {
55                 MessageBox (L"Length, height and width of a box should be srictly positives.", L"New box", MB_ICONEXCLAMATION);
56                 return;
57         }
58         
59         CDialog::OnOK();
60 }
61
62 void CNewBoxDlg::InitFields(Standard_Real x, Standard_Real y, Standard_Real z, Standard_Real w, Standard_Real l, Standard_Real h, const TCollection_ExtendedString &Name)
63 {
64         m_x=x;
65         m_y=y;
66         m_z=z;
67         m_w=w;
68         m_l=l;
69         m_h=h;
70         TCollection_AsciiString AsciiName(Name);
71         m_Name=AsciiName.ToCString();
72 }