JunkBox_Win_Lib 1.5.3
Loading...
Searching...
No Matches
InputNumDLG.cpp
Go to the documentation of this file.
1//
2// InputNumDLG.cpp : 実装ファイル
3//
4
5
6#include "InputNumDLG.h"
7
8
9using namespace jbxwl;
10
11
12
14// CInputNumDLG ダイアログ
15//
16
17IMPLEMENT_DYNAMIC(CInputNumDLG, CDialog)
18
19CInputNumDLG::CInputNumDLG(CWnd* pParent /*=NULL*/)
20 : CDialog(CInputNumDLG::IDD, pParent)
21{
22 valtlBox = NULL;
23 valBox = NULL;
24
25 valtl = _T("");
26 val = 0;
27}
28
29
30
31CInputNumDLG::CInputNumDLG(LPCTSTR vt, int v, CWnd* pParent /*=NULL*/)
32 : CDialog(CInputNumDLG::IDD, pParent)
33{
34 valtlBox = NULL;
35 valBox = NULL;
36
37 valtl = vt;
38 val = v;
39}
40
41
42
46
47
48
49void CInputNumDLG::DoDataExchange(CDataExchange* pDX)
50{
51 CDialog::DoDataExchange(pDX);
52}
53
54
55
56BEGIN_MESSAGE_MAP(CInputNumDLG, CDialog)
57END_MESSAGE_MAP()
58
59
60// CInputNumDLG メッセージ ハンドラ
61
62
63BOOL CInputNumDLG::OnInitDialog()
64{
65 TCHAR buf[LMNAME];
66
67 valtlBox = (CStatic*)GetDlgItem(IDC_INM_VALTTL);
68 valBox = (CEdit*)GetDlgItem(IDC_INM_VAL);
69
70 if (valtl!=_T("")) valtlBox->SetWindowText(valtl);
71
72 sntprintf(buf, LMNAME, _T("%d"), val);
73 valBox->SetWindowText(buf);
74
75 return TRUE;
76}
77
78
79
81{
82 TCHAR buf[LMNAME];
83
84 valBox->GetWindowText(buf, LMNAME);
85 val = ttoi(buf);
86
87 CDialog::OnOK();
88 return;
89}
90
91
92
93
95// CInputFloatNumDLG ダイアログ
96//
97
98IMPLEMENT_DYNAMIC(CInputFloatNumDLG, CDialog)
99
100CInputFloatNumDLG::CInputFloatNumDLG(CWnd* pParent /*=NULL*/)
101 : CDialog(CInputFloatNumDLG::IDD, pParent)
102{
103 valtlBox = NULL;
104 valBox = NULL;
105
106 valtl = _T("");
107 val = 0.0;
108}
109
110
111
112CInputFloatNumDLG::CInputFloatNumDLG(LPCTSTR vt, double v, CWnd* pParent /*=NULL*/)
113 : CDialog(CInputFloatNumDLG::IDD, pParent)
114{
115 valtlBox = NULL;
116 valBox = NULL;
117
118 valtl = vt;
119 val = v;
120}
121
122
123
127
128
129
130void CInputFloatNumDLG::DoDataExchange(CDataExchange* pDX)
131{
132 CDialog::DoDataExchange(pDX);
133}
134
135
136
137BEGIN_MESSAGE_MAP(CInputFloatNumDLG, CDialog)
138END_MESSAGE_MAP()
139
140
141// CInputFloatNumDLG メッセージ ハンドラ
142
143
144BOOL CInputFloatNumDLG::OnInitDialog()
145{
146 TCHAR buf[LMNAME];
147
148 valtlBox = (CStatic*)GetDlgItem(IDC_INM_FLTTTL);
149 valBox = (CEdit*)GetDlgItem(IDC_INM_FLT);
150
151 if (valtl!=_T("")) valtlBox->SetWindowText(valtl);
152
153 sntprintf(buf, LMNAME, _T("%8f"), val);
154 valBox->SetWindowText(buf);
155
156 return TRUE;
157}
158
159
160
162{
163 TCHAR buf[LMNAME];
164
165 valBox->GetWindowText(buf, LMNAME);
166 val = ttof(buf);
167
168 CDialog::OnOK();
169 return;
170}
171
172
173
174
176// CInputMultiFloatNumDLG ダイアログ
177//
178
179IMPLEMENT_DYNAMIC(CInputMultiFloatNumDLG, CDialog)
180
182 : CDialog(CInputMultiFloatNumDLG::IDD, pParent)
183{
184 for (int i=0; i<6; i++) {
185 valtlBox[i] = NULL;
186 valBox[i] = NULL;
187 valtl[i] = _T("");
188 val[i] = 0.0;
189 }
190}
191
192
193
194CInputMultiFloatNumDLG::CInputMultiFloatNumDLG(LPCTSTR t0, double v0, LPCTSTR t1, double v1, LPCTSTR t2, double v2,
195 LPCTSTR t3, double v3, LPCTSTR t4, double v4, LPCTSTR t5, double v5, CWnd* pParent)
196 : CDialog(CInputMultiFloatNumDLG::IDD, pParent)
197{
198 for (int i=0; i<6; i++) {
199 valtlBox[i] = NULL;
200 valBox[i] = NULL;
201 }
202
203 valtl[0] = t0;
204 valtl[1] = t1;
205 valtl[2] = t2;
206 valtl[3] = t3;
207 valtl[4] = t4;
208 valtl[5] = t5;
209 val[0] = v0;
210 val[1] = v1;
211 val[2] = v2;
212 val[3] = v3;
213 val[4] = v4;
214 val[5] = v5;
215}
216
217
218
222
223
224
226{
227 CDialog::DoDataExchange(pDX);
228}
229
230
231
232BEGIN_MESSAGE_MAP(CInputMultiFloatNumDLG, CDialog)
233END_MESSAGE_MAP()
234
235
236
237// CInputNumDLG メッセージ ハンドラ
238
239
240BOOL CInputMultiFloatNumDLG::OnInitDialog()
241{
242 valtlBox[0] = (CStatic*)GetDlgItem(IDC_INM_MLT_VALTTL0);
243 valtlBox[1] = (CStatic*)GetDlgItem(IDC_INM_MLT_VALTTL1);
244 valtlBox[2] = (CStatic*)GetDlgItem(IDC_INM_MLT_VALTTL2);
245 valtlBox[3] = (CStatic*)GetDlgItem(IDC_INM_MLT_VALTTL3);
246 valtlBox[4] = (CStatic*)GetDlgItem(IDC_INM_MLT_VALTTL4);
247 valtlBox[5] = (CStatic*)GetDlgItem(IDC_INM_MLT_VALTTL5);
248
249 valBox[0] = (CEdit*)GetDlgItem(IDC_INM_MLT_VAL0);
250 valBox[1] = (CEdit*)GetDlgItem(IDC_INM_MLT_VAL1);
251 valBox[2] = (CEdit*)GetDlgItem(IDC_INM_MLT_VAL2);
252 valBox[3] = (CEdit*)GetDlgItem(IDC_INM_MLT_VAL3);
253 valBox[4] = (CEdit*)GetDlgItem(IDC_INM_MLT_VAL4);
254 valBox[5] = (CEdit*)GetDlgItem(IDC_INM_MLT_VAL5);
255
256 TCHAR buf[LMNAME];
257// memset(buf, 0, LNAME);
258
259 for (int i=0; i<6; i++) {
260 if (valtl[i]!=_T("")) {
261 valtlBox[i]->SetWindowText(valtl[i]);
262 sntprintf(buf, LMNAME, _T("%8f"), val[i]);
263 valBox[i]->SetWindowText(buf);
264 }
265 else {
266 CString mesg;
267 mesg.LoadString(IDS_STR_UNUSED);
268 valtlBox[i]->SetWindowText(mesg);
269 valtlBox[i]->EnableWindow(FALSE);
270 valBox[i]->SetWindowText(_T("0.0"));
271 valBox[i]->EnableWindow(FALSE);
272 }
273 }
274
275 return TRUE;
276}
277
278
279
281{
282 TCHAR buf[LMNAME];
283// memset(buf, 0, LNAME);
284
285 for (int i=0; i<6; i++) {
286 valBox[i]->GetWindowText(buf, LMNAME);
287 val[i] = ttof(buf);
288 }
289
290 CDialog::OnOK();
291 return;
292}
293
294
295
297
298BOOL jbxwl::InputNumDLG(LPCTSTR title, int* val)
299{
300 CInputNumDLG* inpdlg = new CInputNumDLG(title, *val);
301 if (inpdlg->DoModal()!=IDOK) {
302 delete(inpdlg);
303 return FALSE;
304 }
305
306 *val = inpdlg->val;
307 delete(inpdlg);
308 return TRUE;
309}
310
311
312
313BOOL jbxwl::InputFloatNumDLG(LPCTSTR title, double* val)
314{
315 CInputFloatNumDLG* inpdlg = new CInputFloatNumDLG(title, *val);
316 if (inpdlg->DoModal()!=IDOK) {
317 delete(inpdlg);
318 return FALSE;
319 }
320
321 *val = inpdlg->val;
322 delete(inpdlg);
323 return TRUE;
324}
325
326
327
328BOOL jbxwl::InputMultiFloatNumDLG(LPCTSTR t0, double* v0, LPCTSTR t1, double* v1, LPCTSTR t2, double* v2,
329 LPCTSTR t3, double* v3, LPCTSTR t4, double* v4, LPCTSTR t5, double* v5)
330{
331 CString ttl[6];
332 double val[6];
333
334 for (int i=0; i<6; i++) {
335 ttl[i] = _T("");
336 val[i] = 0.0;
337 }
338
339 if (t0!=NULL && v0!=NULL) {
340 ttl[0] = t0;
341 val[0] = *v0;
342 }
343 if (t1!=NULL && v1!=NULL) {
344 ttl[1] = t1;
345 val[1] = *v1;
346 }
347 if (t2!=NULL && v2!=NULL) {
348 ttl[2] = t2;
349 val[2] = *v2;
350 }
351 if (t3!=NULL && v3!=NULL) {
352 ttl[3] = t3;
353 val[3] = *v3;
354 }
355 if (t4!=NULL && v4!=NULL) {
356 ttl[4] = t4;
357 val[4] = *v4;
358 }
359 if (t5!=NULL && v5!=NULL) {
360 ttl[5] = t5;
361 val[5] = *v5;
362 }
363
364 CInputMultiFloatNumDLG* inpdlg = new CInputMultiFloatNumDLG((LPCTSTR)ttl[0], val[0], (LPCTSTR)ttl[1], val[1],
365 (LPCTSTR)ttl[2], val[2], (LPCTSTR)ttl[3], val[3],
366 (LPCTSTR)ttl[4], val[4], (LPCTSTR)ttl[5], val[5]);
367 if (inpdlg->DoModal()!=IDOK) {
368 delete(inpdlg);
369 return FALSE;
370 }
371
372 if (v0!=NULL) *v0 = inpdlg->val[0];
373 if (v1!=NULL) *v1 = inpdlg->val[1];
374 if (v2!=NULL) *v2 = inpdlg->val[2];
375 if (v3!=NULL) *v3 = inpdlg->val[3];
376 if (v4!=NULL) *v4 = inpdlg->val[4];
377 if (v5!=NULL) *v5 = inpdlg->val[5];
378
379 delete(inpdlg);
380 return TRUE;
381}
382
CInputFloatNumDLG(CWnd *pParent=NULL)
virtual void DoDataExchange(CDataExchange *pDX)
CInputMultiFloatNumDLG(CWnd *pParent=NULL)
virtual void DoDataExchange(CDataExchange *pDX)
CInputNumDLG(CWnd *pParent=NULL)
virtual void OnOK()
virtual void DoDataExchange(CDataExchange *pDX)
BOOL InputMultiFloatNumDLG(LPCTSTR t0, double *v0, LPCTSTR t1=NULL, double *v1=NULL, LPCTSTR t2=NULL, double *v2=NULL, LPCTSTR t3=NULL, double *v3=NULL, LPCTSTR t4=NULL, double *v4=NULL, LPCTSTR t5=NULL, double *v5=NULL)
BOOL InputFloatNumDLG(LPCTSTR title, double *val)
BOOL InputNumDLG(LPCTSTR title, int *val)
#define IDC_INM_MLT_VALTTL5
Definition resource.h:57
#define IDC_INM_VAL
Definition resource.h:42
#define IDC_INM_MLT_VAL3
Definition resource.h:54
#define IDC_INM_FLTTTL
Definition resource.h:43
#define IDC_INM_MLT_VALTTL2
Definition resource.h:51
#define IDC_INM_MLT_VALTTL0
Definition resource.h:47
#define IDC_INM_MLT_VAL0
Definition resource.h:48
#define IDC_INM_MLT_VALTTL1
Definition resource.h:49
#define IDC_INM_FLT
Definition resource.h:44
#define IDC_INM_MLT_VALTTL3
Definition resource.h:53
#define IDC_INM_MLT_VAL4
Definition resource.h:56
#define IDC_INM_MLT_VALTTL4
Definition resource.h:55
#define IDC_INM_MLT_VAL5
Definition resource.h:58
#define IDC_INM_MLT_VAL1
Definition resource.h:50
#define IDS_STR_UNUSED
Definition resource.h:100
#define IDC_INM_MLT_VAL2
Definition resource.h:52
#define IDC_INM_VALTTL
Definition resource.h:41