Добавил:
Studfiles2
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз:
Предмет:
Файл:Программы для выполнения лаб 1 и 2 / KALMAN / SOURCE / SOURCE / TSTPTHRA
.CPP/* Project first
Copyright © 1997 by US. All Rights Reserved.
SUBSYSTEM: first.exe Application
FILE: tstpthra.cpp
AUTHOR: US
OVERVIEW
========
Source file for implementation of TSetupThirdA (TDialog).
*/
#include <owl\owlpch.h>
#pragma hdrstop
#include "tstpthra.h"
#include "tools.h"
//
// Build a response table for all messages/commands handled
// by the application.
//
DEFINE_RESPONSE_TABLE1(TSetupThirdA, TDialog)
//{{TSetupThirdARSP_TBL_BEGIN}}
EV_BN_CLICKED(IDC_BACK-1000, BackBNClicked),
EV_BN_CLICKED(IDC_NEXT-1000, NextBNClicked),
EV_BN_CLICKED(IDC_STOP-1000, StopBNClicked),
//{{TSetupThirdARSP_TBL_END}}
END_RESPONSE_TABLE;
//{{TSetupThirdA Implementation}}
TSetupThirdA::TSetupThirdA (TWindow* parent, FirstSetupList &results, TResId resId, TModule* module):
TDialog(parent, resId, module),
w_data(results), result(SetupStopped)
{
KOldEdit = new TEdit(this, IDC_KOLDEDIT, 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;
}
TSetupThirdA::~TSetupThirdA ()
{
Destroy();
// INSERT>> Your destructor code here.
}
void TSetupThirdA::StopBNClicked ()
{
result = SetupStopped;
CloseWindow(IDCANCEL);
}
void TSetupThirdA::NextBNClicked ()
{
result = SetupContinue;
CloseWindow(IDOK);
}
void TSetupThirdA::BackBNClicked ()
{
result = SetupBack;
CloseWindow(IDCANCEL);
}
BOOL TSetupThirdA::CanClose ()
{
if (!TDialog::CanClose())
return FALSE;
if (result == SetupContinue)
{
if (CheckFloatEditor(this, KOldEdit, SetupNumbersLength, &w_data.Root->KOld, "Коеффициент старения должен"))
return FALSE;
}
w_data.result = result;
return TRUE;
}
void TSetupThirdA::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 TSetupThirdA::EvInitDialog (HWND hWndFocus)
{
BOOL result;
result = TDialog::EvInitDialog(hWndFocus);
SetDefaultId(IDC_NEXT-1000);
return result;
}
Соседние файлы в папке SOURCE