simpledialog.cpp

来自「《基于symbian手机开发与应用》一书的源代码」· C++ 代码 · 共 84 行

CPP
84
字号
/*
* ============================================================================
*  Name     : CDlgDialog from DlgDialog.h
*  Part of  : dlg
*  Created  : 2006-1-8 by 
*  Implementation notes:
*     Initial content was generated by Series 60 AppWizard.
*  Version  :
*  Copyright: 
* ============================================================================
*/

// INCLUDE FILES
#include    "SimpleDialog.h"

#include <eiklabel.h>  // for example label control
#include <avkon.hrh>
#include <aknappui.h>
#include <eikedwin.h>
#include <stringloader.h>
#include "dialog.hrh"
#include <dialog.rsg>
// ================= MEMBER FUNCTIONS =======================


// Destructor
CSimpleDialog::~CSimpleDialog()
    {
    }
//constructor
CSimpleDialog::CSimpleDialog()
{

}

// ---------------------------------------------------------
// CDlgDialog::OkToExitL(TInt aButtonId)
// called by framework when the softkey is pressed
// ---------------------------------------------------------
//
TBool CSimpleDialog::OkToExitL(TInt aButtonId)
{
    // Translate the button presses into commands for the appui & current
    // view to handle
    if ( aButtonId == EAknSoftkeyOk )
        {
        CEikEdwin* editor=static_cast<CEikEdwin*>(ControlOrNull(EConfirmaionNoteDlgCIdEditor));
		if(editor)
		{
			editor->GetText(iName);
        }
       }
    
    return ETrue;
}

// ---------------------------------------------------------
// CDlgDialog::PreLayoutDynInitL();
// called by framework before dialog is shown 
// ---------------------------------------------------------
//
void CSimpleDialog::PreLayoutDynInitL()
    {
     CEikLabel* label=static_cast<CEikLabel*>(ControlOrNull(EConfirmationNoteDlgCIdFileName));
	 if(label)
	 {
		 HBufC* labelText=StringLoader::LoadLC(R_LABEL_TEXT);
		 label->SetTextL(*labelText);
		 CleanupStack::PopAndDestroy(labelText);
	 }
    }

TBool CSimpleDialog::RunDlgLD()
{
	CSimpleDialog* dialog=new(ELeave) CSimpleDialog();
	return dialog->ExecuteLD(R_DIALOG_EDIT_DIALOG);
//	return dialog->ExecuteLD(R_DIALOG_MUTIPLE_DLG);
//	return ETrue;
}


// End of File

⌨️ 快捷键说明

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