simpledlgplayernamedialog.cpp

来自「最新官方例子,图形,描述副,基本控件,通讯协议,等等,」· C++ 代码 · 共 74 行

CPP
74
字号
/**
* 
* @brief Definition of CSimpleDlgPlayerNameDialog
*
* Copyright (c) EMCC Software Ltd 2003
* @version 1.0
*/

// INCLUDE FILES

// Class include
#include "SimpleDlgPlayerNameDialog.h"

// System includes
#include <avkon.hrh> // EAknSoftkeyOk
#include <simpledlg.rsg>
#include <eikedwin.h> // CEikEdwin
#include <eiklabel.h> // CEikLabel
#include <stringloader.h> // StringLoader

// User includes
#include "simpledlg.hrh" // dialog lines

// ================= MEMBER FUNCTIONS =======================

/**
* Called by the framework when a soft key is pressed.
* Saves the dialog data back to the model
* @param aButtonId The soft key which was pressed
*/
TBool CSimpleDlgPlayerNameDialog::OkToExitL(TInt aButtonId)
	{
	if (aButtonId == EAknSoftkeyOk)
		{
		CEikEdwin* editor = static_cast<CEikEdwin*>(ControlOrNull(ESimpleDlgCIdPlayerNameEditor));
		if (editor)
			{
			editor->GetText(iPlayerName);
			}
		}
	return ETrue;
	}


/**
* Called by the framework before the dialog is sized and laid out. 
* Initialises the control values.
*/
void CSimpleDlgPlayerNameDialog::PreLayoutDynInitL()
	{
	CEikLabel* label = static_cast<CEikLabel*>(ControlOrNull(ESimpleDlgCIdPlayerName));
	if (label)
		{
		HBufC* labelText = StringLoader::LoadLC(R_ENTER_NAME_TEXT);
		label->SetTextL(*labelText);
		CleanupStack::PopAndDestroy(labelText);
		}
	}


/**
* Static construction and execution of the dialog. 
* @param aPlayerName the name which this dialog will edit
* @return ETrue if the dialog is dismissed with a positive action, EFalse otherwise
*/
TBool CSimpleDlgPlayerNameDialog::RunDlgLD (TDes& aPlayerName)
	{
		CSimpleDlgPlayerNameDialog* playerNameDialog = new (ELeave) CSimpleDlgPlayerNameDialog(aPlayerName);
		return playerNameDialog->ExecuteLD(R_SIMPLEDLG_PLAYER_NAME_DIALOG);
	}

// End of File

⌨️ 快捷键说明

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