📄 demoform.cpp
字号:
/* Copyright (c) 2004, Nokia. All rights reserved */
// INCLUDE FILES
#include "DemoForm.h"
#include <GuiCtrls.rsg>
#include <akntitle.h> // for title pane
#include <eikspane.h>
#include <avkon.hrh>
// ================= MEMBER FUNCTIONS =========================================
TInt CDemoForm::RunLD()
{
CDemoForm* form = new(ELeave) CDemoForm();
CleanupStack::PushL( form );
form->ConstructL();
CleanupStack::Pop();
return form->ExecuteLD(R_GUICTRLS_DEMO_FORM_DIALOG);
}
TBool CDemoForm::SaveFormDataL()
{
if ( ControlOrNull( EDialogLine1 ) )
{
GetEdwinText( iName, EDialogLine1 );
}
if ( ControlOrNull( EDialogLine2 ) )
{
iAge = NumberEditorValue( EDialogLine2 );
}
if ( ControlOrNull( EDialogLine3 ) )
{
iMobile = NumberEditorValue( EDialogLine3 );
}
if ( ControlOrNull( EDialogLine4 ) )
{
iFax = NumberEditorValue( EDialogLine4 );
}
return ETrue;
}
void CDemoForm::DoNotSaveFormDataL()
{
if ( ControlOrNull( EDialogLine1 ) )
{
SetEdwinTextL( EDialogLine1, &iName );
}
if ( ControlOrNull( EDialogLine2 ) )
{
SetNumberEditorValue( EDialogLine2, iAge );
}
if ( ControlOrNull( EDialogLine3 ) )
{
SetNumberEditorValue( EDialogLine3, iMobile );
}
if ( ControlOrNull( EDialogLine4 ) )
{
SetNumberEditorValue( EDialogLine4, iFax );
}
}
void CDemoForm::PostLayoutDynInitL()
{
DoNotSaveFormDataL();
}
// ----------------------------------------------------------------------------
// CDemoForm::QuerySaveChangesL()
// Show save query. If user answers "No" to this query.
// return field value to the value which is before editing.
// This is called Back-softkey when edit mode.
// ----------------------------------------------------------------------------
//
TBool CDemoForm::QuerySaveChangesL()
{
return CAknForm::QuerySaveChangesL();
// Or use the following code to save form data with confirm.
//SaveFormDataL();
//return ETrue;
}
TBool CDemoForm::OkToExitL(TInt aButtonId)
{
TBool ret = CAknForm::OkToExitL(aButtonId);
if (ret)
{
CEikStatusPane* sp = iEikonEnv->AppUiFactory()->StatusPane();
CAknTitlePane* title = (CAknTitlePane*)sp->ControlL( TUid::Uid( EEikStatusPaneUidTitle ) );
title->SetTextToDefaultL();
}
return ret;
}
// End of File
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -