145 lines
3.4 KiB
C++
145 lines
3.4 KiB
C++
// dlginputtext.cpp : implementation file
|
|
//
|
|
#include "stdafx.h"
|
|
#include "ACP_Base.h"
|
|
#include "ITF.h"
|
|
|
|
#include "DlgInput.hpp"
|
|
|
|
#include "..\Main\Inc\_EditID.h"
|
|
#include "TUT.h"
|
|
|
|
#ifdef _DEBUG
|
|
#define new DEBUG_NEW
|
|
#undef THIS_FILE
|
|
static char THIS_FILE[] = __FILE__;
|
|
#endif
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
// CDlgInputText dialog
|
|
|
|
|
|
CDlgInputText::CDlgInputText(CWnd* pParent /*=NULL*/)
|
|
: CDialog(CDlgInputText::IDD, pParent)
|
|
{
|
|
//{{AFX_DATA_INIT(CDlgInputText)
|
|
m_Data_EditText = _T("");
|
|
//}}AFX_DATA_INIT
|
|
m_oCstMessage = "";
|
|
m_oCstTitle = "";
|
|
m_csDefaultValue = "";
|
|
m_xPoint . x = 0;
|
|
m_xPoint . y = 0;
|
|
m_bSelect = FALSE;
|
|
}
|
|
|
|
|
|
void CDlgInputText::DoDataExchange(CDataExchange* pDX)
|
|
{
|
|
CDialog::DoDataExchange(pDX);
|
|
//{{AFX_DATA_MAP(CDlgInputText)
|
|
DDX_Text(pDX, IDC_EDIT_TEXT, m_Data_EditText);
|
|
//}}AFX_DATA_MAP
|
|
}
|
|
|
|
|
|
BEGIN_MESSAGE_MAP(CDlgInputText, CDialog)
|
|
//{{AFX_MSG_MAP(CDlgInputText)
|
|
ON_WM_DESTROY()
|
|
//}}AFX_MSG_MAP
|
|
END_MESSAGE_MAP()
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
// CDlgInputText set data methods
|
|
|
|
void CDlgInputText::SetMessage(char *_szMessage)
|
|
{
|
|
m_oCstMessage = _szMessage;
|
|
}
|
|
|
|
char * CDlgInputText::GetInputText()
|
|
{
|
|
return (char*)(LPCTSTR)m_Data_EditText;
|
|
}
|
|
|
|
void CDlgInputText::SetTitle(char *_szTitle)
|
|
{
|
|
m_oCstTitle = _szTitle;
|
|
}
|
|
|
|
void CDlgInputText::SetPos(POINT *_pPoint)
|
|
{
|
|
memcpy ( &m_xPoint, _pPoint, sizeof POINT ) ;
|
|
}
|
|
|
|
void CDlgInputText::SetSelect(BOOL _bSelect /*=TRUE*/ )
|
|
{
|
|
m_bSelect = _bSelect;
|
|
}
|
|
|
|
void CDlgInputText::SetDefaultValue(char *_szValue)
|
|
{
|
|
m_csDefaultValue = _szValue;
|
|
}
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
// CDlgInputText message handlers
|
|
|
|
BOOL CDlgInputText::OnInitDialog()
|
|
{
|
|
CDialog::OnInitDialog();
|
|
|
|
SetWindowText(m_oCstTitle);
|
|
GetDlgItem(IDC_STATIC_TEXT)->SetWindowText(m_oCstMessage);
|
|
m_Data_EditText = m_csDefaultValue;
|
|
GetDlgItem(IDC_EDIT_TEXT) -> SetWindowText( m_Data_EditText );
|
|
if( m_bSelect )
|
|
{
|
|
((CEdit*)GetDlgItem(IDC_EDIT_TEXT)) -> SetSel( 0, -1 ); // select text
|
|
}
|
|
|
|
CRect oRect;
|
|
CSize oScreenSize( GetSystemMetrics( SM_CXSCREEN ), GetSystemMetrics( SM_CYSCREEN ) ) ;
|
|
|
|
GetClientRect(&oRect);
|
|
oRect += m_xPoint;
|
|
// dialog must be in screen
|
|
if ( oRect . right >= oScreenSize . cx )
|
|
{
|
|
oRect . OffsetRect ( -(oRect . right - oScreenSize . cx + 10), 0 );
|
|
}
|
|
if ( oRect . bottom >= oScreenSize . cy )
|
|
{
|
|
oRect . OffsetRect ( 0, -(oRect . bottom - oScreenSize . cy + 10) );
|
|
}
|
|
MoveWindow( &oRect ) ;
|
|
|
|
// register controls for TUT
|
|
TUT_M_vGetTutDll();
|
|
TUT_M_vRegisterControlID( IDC_EDIT_TEXT, "TAC_INPUT_TEXT", TUT_e_TextEdit );
|
|
TUT_M_vRegisterControlID( IDOK, "TAC_INPUT_OK", TUT_e_Button );
|
|
TUT_M_vRegisterControlID( IDCANCEL, "TAC_INPUT_CANCEL",TUT_e_Button );
|
|
//
|
|
|
|
return TRUE; // return TRUE unless you set the focus to a control
|
|
// EXCEPTION: OCX Property Pages should return FALSE
|
|
}
|
|
|
|
void CDlgInputText::OnOK()
|
|
{
|
|
// TODO: Add extra validation here
|
|
UpdateData(TRUE);
|
|
if( !m_Data_EditText.IsEmpty() )
|
|
CDialog::OnOK();
|
|
}
|
|
|
|
void CDlgInputText::OnDestroy()
|
|
{
|
|
TUT_M_vGetTutDll();
|
|
TUT_M_vUnregisterControlID( IDC_EDIT_TEXT );
|
|
TUT_M_vUnregisterControlID( IDOK );
|
|
TUT_M_vUnregisterControlID( IDCANCEL );
|
|
|
|
CDialog::OnDestroy();
|
|
}
|