|
Nokia N97 SDK Example Applications Guide |
1. About this Example
2. User Interface
3. Design and implementation
In the note example application, the following functions are introduced:
Typical uses of the note control are:
The following are the commands on the Options menu:
| Menu
|
Examples to be shown |
| Error note | Shows the error note example (See section 2.3.1, Error note). |
| Wait note | Shows the wait note example (See section 2.4, Wait note). |
| Dynamic text | Shows the example of the note with dynamic text (See section 2.5.1, Dynamic text). |
| Progress note | Shows the progress note example (See section 2.6, Progress note). |
| Global Confirmation note | Shows the Global confirmation note example (See section 2.7.1, Global confirmation note). |
| Exit | Ends the application. |
The Error note dialog disappears (right screen in the following figure) when you press any key or after waiting for a given number of seconds.
The Wait note dialog disappears when you press the right soft key (Cancel).
This dialog disappears when you press the right soft key (Cancel) or when the progress bar reaches its maximum point.
RESOURCE DIALOG r_aknexnote_error_note
{
flags = EAknErrorNoteFlags;
items =
{
DLG_LINE
{
type = EAknCtNote;
id = EAknExNoteCtrlIdErrorNote;
control = AVKON_NOTE
{
layout = EGeneralLayout;
singular_label = STRING_r_exnt_error_singular;
plural_label = STRING_r_exnt_error_plural;
imagefile = AKNEXNOTE_BMPFILE_NAME;
imageid = EMbmAknexnoteAknexnoteerroricon;
};
}
};
}
In the case of a static message, a dialog is first created and then the ExecuteDlgLD function is called.
// Create CAknNoteDialog instance CAknNoteDialog* dlg = new ( ELeave ) CAknNoteDialog( aTone, aTimeout ); dlg->PrepareLC( aResourceId ); dlg->SetTextPluralityL( aPlural ); // Show the Dialog dlg->RunLD();
In the case of a dynamic message, a dialog is first created and the resource data is specified using the PrepareLC function.
Then RunDlgLD is called after setting the changeable part of data and the dialog is displayed.
// Create CAknNoteDialog instance CAknNoteDialog* dlg = new ( ELeave ) CAknNoteDialog( CAknNoteDialog::EConfirmationTone, CAknNoteDialog::ELongTimeout ); dlg->PrepareLC( R_AKNEXNOTE_DYNAMIC_TEXT ); TTime theTime( KAknExNoteInitializeTime ); theTime.UniversalTime(); TInt64 randSeed( theTime.Int64() ); TInt number( Math::Rand( randSeed ) % KAknExNoteRandomNumberRange ); dlg->SetTextPluralityL( EFalse ); dlg->SetTextNumberL( number ); // Show the Dialog dlg->RunLD();
//Allocate TBuf with constant length. TBuf<KAknExNoteTextBufLength> text( NULL ); // Reads a resource into a descriptor. CEikonEnv::Static()->ReadResource( text, aResourceId ); TPtrC noteText( text ); // Create new CAknGlobalNote instance. CAknGlobalNote* globalNote = CAknGlobalNote::NewL(); // Push CAknGlobalNote's pointer to CleanupStack CleanupStack::PushL( globalNote ); iPermanentNoteId = globalNote->ShowNoteL( aType, noteText ); // Pop and Destroy CAknGlobalNote's pointer from CleanupStack CleanupStack::PopAndDestroy();
|
© Nokia 2009 |