Scope
AreaChooseDlg.cpp
1 #include "stdafx.h"
2 #include "AreaChooseDlg.h"
3 #include "../resource.h"
4 
5 namespace scope {
6  namespace gui {
7 
8 LRESULT CAreaChooseDlg::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM lParam, BOOL& /*bHandled*/) {
9  std::array<uint32_t, 4> controls = { IDC_AREA1, IDC_AREA2, IDC_AREA3, IDC_AREA4 };
10 
11  // Attach radio buttons to controls
12  for ( uint32_t a = 0 ; a < buttons.size() ; a++ )
13  buttons[a].Attach(GetDlgItem(controls[a]));
14 
15  // Disable non-used radio buttons
16  for ( uint32_t a = static_cast<uint32_t>(lParam) ; a < buttons.size() ; a++ )
17  buttons[a].EnableWindow(FALSE);
18 
19  // Focus on the first button
20  buttons[0].SetFocus();
21 
22  CenterWindow(GetParent());
23  return TRUE;
24 }
25 
26 LRESULT CAreaChooseDlg::OnCloseCmd(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/) {
27  int ret = 0;
28  switch ( wID ) {
29  case IDC_AREA1:
30  ret = 0;
31  break;
32  case IDC_AREA2:
33  ret = 1;
34  break;
35  case IDC_AREA3:
36  ret = 2;
37  break;
38  case IDC_AREA4:
39  ret = 3;
40  break;
41  default:
42  ret = -1;
43  }
44 
45  EndDialog(ret);
46  return 0;
47 }
48 
49 }}
LRESULT OnCloseCmd(WORD, WORD wID, HWND, BOOL &)
This is the include file for standard system include files, or project specific include files that ar...
LRESULT OnInitDialog(UINT, WPARAM, LPARAM, BOOL &)
Initializes the dialog.
std::array< CButton, 4 > buttons
buttons for area choosing
Definition: AreaChooseDlg.h:13