textinputdialog.cpp

来自「Symbian OS C++ for Mobile Phones v3 Exam」· C++ 代码 · 共 56 行

CPP
56
字号

#include <oandx.rsg>
#include "oandxappui.h"
#include "oandxcontroller.h"


CTextInputDialog::CTextInputDialog(const TDesC& aTitle, TDes& aBuffer)
/**
	Record the dialog's title and the descriptor into which the
	data is written.
	Record descriptor into which the data is written.
	
	@param	aDlgTitle		Dialog title text.  Thios must be valid until
							the dialog has been constructed.
	@param	aBuffer			Buffer which will be populated with text
							entered by the user.
 */
:	iTitle(aTitle),
	iBuffer(aBuffer)
	{
	// empty.
	}

void CTextInputDialog::PreLayoutDynInitL()
/**
	Overrides CEikDialog by populating the dialog from the initial name.
 */
	{
	SetTitleL(iTitle);
	
	CEikEdwin* pew = static_cast<CEikEdwin*>(Control(EAddressCtIdName));
	pew->SetTextLimit(iBuffer.MaxLength());
	}

TBool CTextInputDialog::OkToExitL(TInt aKeyCode)
/**
	Overrides CEikDialog by deciding whether it is all right to
	close the dialog.  On exit the updated address is stored
	in iAddress.  This function leaves and displays a message
	if no address has been entered.

	@param	aKeyCode		The ID of the button that was activated.
	@return					ETrue, meaning the dialog can be closed.
 */
	{
	(void) aKeyCode;

	CEikEdwin* pew = static_cast<CEikEdwin*>(Control(EAddressCtIdName));
	pew->GetText(iBuffer);
	if (iBuffer.Length() == 0)
		CEikonEnv::Static()->LeaveWithInfoMsg(R_TEXTINPUT_ENTER_TEXT);

	return ETrue;
	}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?