Добавил:
Studfiles2
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз:
Предмет:
Файл:Программы для выполнения лаб 1 и 2 / KALMAN / SOURCE / SOURCE / TSTPTHRD
.CPP/* Project first
Copyright © 1997 by US. All Rights Reserved.
SUBSYSTEM: first.exe Application
FILE: tstpthrd.cpp
AUTHOR: US
OVERVIEW
========
Source file for implementation of TSetupThirdD (TDialog).
*/
#include <owl\owlpch.h>
#pragma hdrstop
#include "tstpthrd.h"
#include "tools.h"
//
// Build a response table for all messages/commands handled
// by the application.
//
DEFINE_RESPONSE_TABLE1(TSetupThirdD, TDialog)
//{{TSetupThirdDRSP_TBL_BEGIN}}
EV_BN_CLICKED(IDC_BACK-1000, BackBNClicked),
EV_BN_CLICKED(IDC_NEXT-1000, NextBNClicked),
EV_BN_CLICKED(IDC_STOP-1000, StopBNClicked),
//{{TSetupThirdDRSP_TBL_END}}
END_RESPONSE_TABLE;
//{{TSetupThirdD Implementation}}
TSetupThirdD::TSetupThirdD (TWindow* parent, FirstSetupList &results, TResId resId, TModule* module):
TDialog(parent, resId, module),
w_data(results), result(SetupStopped)
{
MEdit = new TEdit(this, IDC_AFMEDIT, SetupNumbersLength, 0);
AlphaEdit = new TEdit(this, IDC_AFALPHAEDIT, SetupNumbersLength, 0);
BetaEdit = new TEdit(this, IDC_AFBETAEDIT, SetupNumbersLength, 0);
BackButton = new TOwnerButton(this, IDC_BACK-1000, 0);
NextButton = new TOwnerButton(this, IDC_NEXT-1000, 0);
StopButton = new TOwnerButton(this, IDC_STOP-1000, 0);
w_data.result = SetupStopped;
}
TSetupThirdD::~TSetupThirdD ()
{
Destroy();
// INSERT>> Your destructor code here.
}
void TSetupThirdD::StopBNClicked ()
{
result = SetupStopped;
CloseWindow(IDCANCEL);
}
void TSetupThirdD::NextBNClicked ()
{
result = SetupContinue;
CloseWindow(IDOK);
}
void TSetupThirdD::BackBNClicked ()
{
result = SetupBack;
CloseWindow(IDCANCEL);
}
BOOL TSetupThirdD::CanClose ()
{
if (!TDialog::CanClose())
return FALSE;
if (result == SetupContinue)
{
if (CheckFloatEditor(this, MEdit, SetupNumbersLength, &w_data.Root->AfM, "M должно") ||
CheckFloatEditor(this, AlphaEdit, SetupNumbersLength, &w_data.Root->AfAlpha, "Alpha должна") ||
CheckFloatEditor(this, BetaEdit, SetupNumbersLength, &w_data.Root->AfBeta, "Beta должна"))
return FALSE;
}
w_data.result = result;
return TRUE;
}
void TSetupThirdD::SetupWindow ()
{
TDialog::SetupWindow();
// Position window to the center of desktop
TRect dialog_pos;
RECT desktop_pos;
unsigned dcx, dcy, sx, sy;
GetWindowRect(dialog_pos);
::GetWindowRect(GetDesktopWindow(), &desktop_pos);
dcx = desktop_pos.left + desktop_pos.right;
dcy = desktop_pos.top + desktop_pos.bottom;
sx = dialog_pos.right - dialog_pos.left;
sy = dialog_pos.bottom - dialog_pos.top;
dialog_pos.left = (dcx - sx) >> 1;
dialog_pos.right = (dcx + sx) >> 1;
dialog_pos.top = (dcy - sy) >> 1;
dialog_pos.bottom = (dcy + sy) >> 1;
MoveWindow(dialog_pos, FALSE);
}
BOOL TSetupThirdD::EvInitDialog (HWND hWndFocus)
{
BOOL result;
result = TDialog::EvInitDialog(hWndFocus);
SetDefaultId(IDC_NEXT-1000);
return result;
}
Соседние файлы в папке SOURCE