forked from chrisoldwood/DDEQuery
-
Notifications
You must be signed in to change notification settings - Fork 0
/
PrefsDlg.cpp
94 lines (83 loc) · 2.06 KB
/
PrefsDlg.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
/******************************************************************************
** (C) Chris Oldwood
**
** MODULE: PREFSDLG.CPP
** COMPONENT: The Application
** DESCRIPTION: CPrefsDlg class definition.
**
*******************************************************************************
*/
#include "Common.hpp"
#include "PrefsDlg.hpp"
#include "DDEQueryApp.hpp"
/******************************************************************************
** Method: Default constructor.
**
** Description: .
**
** Parameters: None.
**
** Returns: Nothing.
**
*******************************************************************************
*/
CPrefsDlg::CPrefsDlg()
: CDialog(IDD_PREFS)
, m_ebDDETimeOut(false, 8, 0)
, m_ebFlashTime(false, 8, 0)
{
DEFINE_CTRL_TABLE
CTRL(IDC_DDE_TIMEOUT, &m_ebDDETimeOut)
CTRL(IDC_FLASH_TIME, &m_ebFlashTime)
END_CTRL_TABLE
DEFINE_CTRLMSG_TABLE
END_CTRLMSG_TABLE
}
/******************************************************************************
** Method: OnInitDialog()
**
** Description: Initialise the dialog.
**
** Parameters: None.
**
** Returns: Nothing.
**
*******************************************************************************
*/
void CPrefsDlg::OnInitDialog()
{
// Initialise controls.
m_ebDDETimeOut.IntValue(App.m_dwDDETimeOut);
m_ebFlashTime.IntValue(App.m_nFlashTime);
}
/******************************************************************************
** Method: OnOk()
**
** Description: The OK button was pressed.
**
** Parameters: None.
**
** Returns: true or false.
**
*******************************************************************************
*/
bool CPrefsDlg::OnOk()
{
// Validate controls.
if (m_ebDDETimeOut.TextLength() == 0)
{
AlertMsg(TXT("Please provide the 'DDE Timeout Time'"));
m_ebDDETimeOut.Focus();
return false;
}
if (m_ebFlashTime.TextLength() == 0)
{
AlertMsg(TXT("Please provide the 'Advise Indication Time'"));
m_ebFlashTime.Focus();
return false;
}
// Save new settings.
App.m_dwDDETimeOut = m_ebDDETimeOut.IntValue();
App.m_nFlashTime = m_ebFlashTime.IntValue();
return true;
}