SlideShare a Scribd company logo
1 of 71
Symbian OS UI-Development for S60 1 Andreas Jakl, 2008 v2.0b – 20 January 2009
Disclaimer These slides are provided free of charge at http://www.symbianresources.com and are used during Symbian OS courses at the University of Applied Sciences in Hagenberg, Austria ( http://www.fh-hagenberg.at/ ) Respecting the copyright laws, you are allowed to use them: for your own, personal, non-commercial use in the academic environment In all other cases (e.g. for commercial training), please contact andreas.jakl@fh-hagenberg.at The correctness of the contents of these materials cannot be guaranteed. Andreas Jakl is not liable for incorrect information or damage that may arise from using the materials. Parts of these materials are based on information from Symbian Press-books published by John Wiley & Sons, Ltd. This document contains copyright materials which are proprietary to Symbian, UIQ, Nokia and SonyEricsson. “S60™” is a trademark of Nokia. “UIQ™” is a trademark of UIQ Technology. Pictures of mobile phones or applications are copyright their respective manufacturers / developers. “Symbian ™”, “Symbian OS ™” and all other Symbian-based marks and logos are trademarks of Symbian Software Limited and are used under license. © Symbian Software Limited 2006.  Andreas Jakl, 2008 2
Contents S60 UI Overview Resource Files andLocalization Defining Menus Loading Strings fromResource Files Label Controls Modifyingthe Status Pane Dialogs Overview Custom Dialog Notes Query Dialogs Andreas Jakl, 2008 3
S60 UI Elements of the Andreas Jakl, 2008 4
UI-Components Window Sub-component of the device screen Principal window filling up entire screen Not used for display Can contain many panes Pane Sub-component of a window Can contain many sub-panes Andreas Jakl, 2008 5
S60 UI Status Pane Information about running application & device (e.g. battery strength) Main Pane Application content Control Pane Softkey labels Andreas Jakl, 2008 6 Status Pane Main Pane Control Pane
Status Pane Usually contains of sub-panes: Title pane Context pane Navigation pane Signal pane Battery pane Automatically generated by AppUi Andreas Jakl, 2008 7 Batterypane /Universalindicatorpane Title pane Contextpane Navipane Signal pane
Navigation Pane Either empty or “decorated” with controls: Tabs Indicate different pages (= views) Navigation label Optional: Text on a tab Navigation image Optional: Image on a tab Indicators State of important element, e.g. volume Custom Controls Any CCoeControl-derived object Andreas Jakl, 2008 8
Resource Files Define your UI Andreas Jakl, 2008 9
Resource Files Separate UI-elements from code Define: User Interface (Menus, Dialogs, Lists) (Localizable) Text Application Information Advantages: Information only loaded when needed (save RAM) Localizable Can be compressed Andreas Jakl, 2008 10
Applications & Resources App. has to have <AppName>.rss Can optionally use multiple resource files Resource files have their own syntax! .rss-files compiled to .rsc + .rsg (= header) C++ code references resources by including .rsg-files Andreas Jakl, 2008 11
Typical Logical Structure Andreas Jakl, 2008 12 When your application is localized, use .lxx files or several .rls-filesto provide localized strings. The number specifies the location code (e.g. 03 = German) <AppName>_reg.rss Application Information <AppName>_reg.rsg Resource header output from resource compiler <AppName>_reg.rsc / r01... Compiled resource file <AppName>.rls / l01... Localisable strings, included from .rss Resource Compiler <AppName>.rss Main resource file Contains UI-definitions, literals <AppName>.rsg <AppName>.hrh Resource Header, usually contains command IDs for menus, ... <AppName>.rsc / r01...
File Type Overview Resource files and their meaning: Andreas Jakl, 2008 13 Two different possible naming conventions
Resource File Format Consist of (multiple) data constructs with uppercase keywords STRUCT keyword Sequence of items, each with name and data type Not often needed directly Andreas Jakl, 2008 14 Name Keyword STRUCT MYDATA { WORD value=0; LTEXT main_text; LTEXT text_items[]; } Data Type Items
Resource File Format RESOURCE-keyword Creates an instance of a STRUCT Assigns values to its items Predefined STRUCTs from Symbian OS / S60 / UIQ for UI-definitions, Strings, ... Andreas Jakl, 2008 15 // Creates an instanceof STRUCT fromthepreviousslide RESOURCE MYDATA r_mydata_res{ value=3; main_text="sometextstring"; text_items={"item 1", "item 2"}; }
Resource File Structure Compulsory content of the main resource file: Andreas Jakl, 2008 16 HelloWorld.rss NAME HELO							// 4 letter resource id [ ... includes ... ]				// Resource compiler handles includes like the C++ compiler #include "DialogTest.hrh" 		// Defines enumerated constants for the application’s commands #include "DialogTest.rls"		// (or .loc) – defines strings used in the UI. RESOURCE RSS_SIGNATURE { }				// optional version info RESOURCE TBUF { buf = ""; }				// can specify doc file – here: unused -> blank RESOURCE EIK_APP_INFO r_application_dialog_test_app_ui { cba = R_AVKON_SOFTKEYS_OPTIONS_EXIT;	// Softkey-definition (S60 predefined) status_pane = r_application_status_pane;	// App-wide status pane (defined below in .rss) } STRUCTs are defined in eikon.rh
String Resources Define text in one place – and not in the source code Easy to modify, easy to localize Andreas Jakl, 2008 17 <AppName>.rls / .l01...	(Text only!) rls_stringSTR_Loading “Loading...” rls_stringSTR_Caption “Hello World” <Program>.cpp(C++ Source Code) #include <stringloader.h> #include <<AppName>.rsg> void C<AppName>AppUi::DisplayInfo() { HBufC* buf = StringLoader::LoadLC ( R_LOADING );     [...] CleanupStack::PopAndDestroy(buf); } <AppName>.rss(UI Definition) #include “<AppName>.rls” RESOURCE LOCALISABLE_APP_INFO r_localisable_app_info { short_caption = STR_Caption; } RESOURCE TBUF r_loading { buf = STR_Loading; } [...] <AppName>.rsg(Generated by resource compiler) #define R_LOCALISABLE_APP_INFO               0x66a61005 #define R_LOADING                      		0x66a61006
Localization Resource files compiled multiple times, once for each language Supported languages defined in .mmp Current language set by compiler using #define Andreas Jakl, 2008 18 Journey.mmp START RESOURCE Journey.rss HEADER TARGETPATH resourcepps LANG 01 03 END Journey.loc Two common naming conventions: 1.) .loc as junction & .l01... for each language 2.) .rls as junction & Journey_01.rls... for each language #ifdef LANGUAGE_01 	#include “journey.l01”	// UK English #elif defined LANGUAGE_03 	#include “journey.l03”	// German #else 	#include “journey.l01”	// Default to UK English #endif
<AppName>.loc Include currently active language #ifdef LANGUAGE_01... <AppName>.r01 UK English compiled resource file <AppName>.r02 French compiled resource file Resource Compiler <AppName>.rss Strings replaced with #defines from currently active .lxx <AppName>.r03 German compiled resource file Localization – Overview Andreas Jakl, 2008 19 If using .rls-files instead of .loc, use rls_string instead of #define <AppName>.l01 UK English #define STR_hi “Hello” <AppName>.l02 French #define STR_hi “Salut” <AppName>.l03 German #define STR_hi “Hallo”
Localized Installation Usually: All languages contained in .sis-file Only language matching phone language is installed .pkg-file defines which resource files to install for which language (all other files won’t be installed) Installed resource-file renamed from .r01/.rxx to .rsc Andreas Jakl, 2008 20 Journey.pkg &EN,GE// Defines which languages are available [...] { 	"ymbian.160_3rd_MRpoc32ataesourceppsourney.r01" 	"ymbian.160_3rd_MRpoc32ataesourceppsourney.r03“ }  -"!:esourceppsourney.rsc“	// Only current phone language will get installed!
Internationalisation? ... it’s a lot more than translating text! Symbian OS: Locale Settings API Andreas Jakl, 2008 21
UI-Elements Defining and using Andreas Jakl, 2008 22
Menus Menu Bar Defines title of the menu(not shown in S60) and the contained menu panes (usually 1) Can be default for Application orindividual for each view Menu Pane Defines unique section of a menu Contains menu items, each with text string and command id Andreas Jakl, 2008 23 Menu Pane Menu Bar
Hierarchical Structure Andreas Jakl, 2008 24 AVKON_VIEW EIK_APP_INFO Menu Bar can be part of a specific viewor of the general application MENU_BAR Menu Bar contains n Menu Panes MENU_PANE MENU_PANE MENU_ITEM (s): MENU_ITEM (s)
Hands-On: Menu Create a new project: Name: “UiTest” Template: “S60 GUI Application with UI Designer” Design: Empty Andreas Jakl, 2008 25 We won’t use the UI designer in this example, but the wizard creates a view-based architecture WARNING: Do not use the UI-Designer in this example, as it would override some of our own source code! We want to do this in the first step...
Defining your menu Define the menu text in the .l01-file Define the menu command ids in the .hrh-file Andreas Jakl, 2008 26 UiTestContainer.l01 #define STR_ShowYourName "Show your name" #define STR_Exit "Exit" UiTestContainer.hrh enumTUiTestContainerViewCommands 	{ EUiTestCmdShowYourName = 0x6000,		// Any number that isn’t 0 EUiTestCmdExit// … enum automatically counts upwards 	}; Create this file in the inc-folder of your project
Menu Definition? Menu command in the .hrh-file: Used in menu definition (.rss) Used for checking which menu item was selected (<View>.cpp) Andreas Jakl, 2008 27 .hrh Defines menu command ids .rssUses command ids in menu item definition <View>.cpp Checks selected menu item in HandleCommandL()
Defining your menu Create the menu in the .rss(i) file Andreas Jakl, 2008 28 UiTestContainer.rssi #include "UiTestContainer.hrh"	// Add this at the beginning so that the command id is known RESOURCE AVKON_VIEW r_ui_test_container_ui_test_container_view { cba = R_AVKON_SOFTKEYS_OPTIONS_EXIT; menubar = r_ui_test_container_options_menu; } RESOURCE MENU_BAR r_ui_test_container_options_menu { titles = { MENU_TITLE { txt = "Example Menu"; menu_pane = r_ui_test_container_menu_pane; } }; } RESOURCE MENU_PANE r_ui_test_container_menu_pane { items = { MENU_ITEM { command = EUiTestCmdShowYourName; txt = STR_ShowYourName; }, MENU_ITEM { command = EUiTestCmdExit; txt = STR_Exit; } }; } [...]
Menu Definition? AVKON_VIEW (S60 View-Architecture) CBA: Defines Softkey labels In this case Symbian OS standard-values (Options / Exit) MENU_BAR Defines contained menu panes and their titles MENU_PANE Defines individual items Uses command ids from .hrh-file and text from .loc Andreas Jakl, 2008 29
Handling Commands View-based architecture, events are sent to: HandleCommandL() of the current view If unhandled, HandleCommandL() of the AppUi Andreas Jakl, 2008 30 UiTestContainerView.cpp #include "UiTestContainer.hrh" void CUiTestContainerView::HandleCommandL( TIntaCommand ) { TBoolcommandHandled = EFalse; switch ( aCommand ) { case EUiTestCmdExit:  // Exit the application when our new menu item is selected AppUi()->HandleCommandL( EEikCmdExit );  break; default: break; } […] } Pre-defined system command. App. has to quit in any case, without a user query (e.g. forced shutdown)
Hands-On: Loading Strings Task: Load a String from a resource file and display it in a Label-control Andreas Jakl, 2008 31
Strings? Hard-coding strings in source code: ... that’s bad! Why? Difficult to find and change later on No clear application structure(mix source code with text) Not localizable Andreas Jakl, 2008 32 // Defining literals with the _LIT-macro _LIT(msg, “Loading…”); // The deprecated _L-macro iEikonEnv->AlertWin(_L(“Starting…”));
Adding a Label-Control Label-Control declared in <eiklabel.h> (see SDK-help for CEikLabel – it’s a Symbian OS control!) Define as private member of UiTestContainer.h:CEikLabel* iLabelName; Initialization code: Andreas Jakl, 2008 33 UiTestContainer.cpp void CUiTestContainer::ConstructL (…) { […] iLabelName = new (ELeave) CEikLabel(); iLabelName->SetContainerWindowL( *this );		// Label is non-window-owning iLabelName->SetTextL(KNullDesC);				// Initially no text iLabelName->SetAlignment( EHCenterVCenter );	// Align the text in the center iLabelName->SetExtentToWholeScreen();		// Set the size and position […] } CUiTestContainer::~CUiTestContainer() { 	delete iLabelName;						// Don’t forget to delete the label! }
Control-Management The Container has to manage the controls ( see “GUI Architectures” module) Wizard generates “old”, manual control-management Add the new label to the enum-control-counter Adapt the ComponentControl()-function Andreas Jakl, 2008 34 UiTestContainer.h enumTControls { ELabelName, ELastControl }; UiTestContainer.cpp CCoeControl* CUiTestContainer::ComponentControl( TIntaIndex ) const { switch ( aIndex ) { case ELabelName: return iLabelName; break; }
Modifying the Label-Text Create a function to modify the label text (define in .h) Define a text as a string resource... this allows you to load the text (defined in .l01) into a descriptor from within the source code Andreas Jakl, 2008 35 UiTestContainer.cpp void CUiTestContainer::SetLabelTextL( const TDesC& aText ) { iLabelName->SetTextL(aText);		// Update the text of the label DrawDeferred();				// Request a screen redraw } UiTestContainer.rssi RESOURCE TBUF r_labeltext { buf = STR_ShowYourName; }
Executing the Text-Change In CUiTestContainerView::HandleCommandL() for the other menu item: Use the StringLoader to load the text into a HBufC and call the iUiTestContainer->SetLabelTextL()-function (see Slide 17) Dereference the HBufC with a * when using it as a TDesC& parameter Andreas Jakl, 2008 36
Hands-on: Dynamic Menu Task: Change menu content depending on app. state Andreas Jakl, 2008 37
Dynamic Menu New TBool instance variable: iLabelTextSet Define it in UiTestContainerView (Default: EFalse) Set to ETrue when menu item is selected Override menu init-function from view base class Called after menu is read from resource file, but before it is displayed Andreas Jakl, 2008 38 UiTestContainerView.cpp void CUiTestContainerView::DynInitMenuPaneL(TIntaResourceId, CEikMenuPane* aMenuPane) { // Check if the menu pane that is initialized is the one we are waiting for 	if (aResourceId == R_UI_TEST_CONTAINER_MENU_PANE) { // Dim the item depending on the application state aMenuPane->SetItemDimmed(EUiTestCmdShowYourName, iLabelTextSet); 	} }
Hands-on: Navigation Pane Dynamically modify the S60 Navigation Pane Andreas Jakl, 2008 39
Accessing the Pane Access the status pane: ... in the AppUi:CEikStatusPane* sp = StatusPane(); ... in an Avkon View:CEikStatusPane* sp = iAvkonAppUi->StatusPane(); ... in most other places:CEikStatusPane* sp = iEikonEnv->AppUiFactory()	->StatusPane(); ... for the rest:CEikStatusPane* sp = CEikonEnv::Static()	->AppUiFactory()->StatusPane(); Access the required sub-pane (Title, Navigation, ...) Andreas Jakl, 2008 40
Navigation Decorator Navigation Decorator is a control (CCoeControl) Options: label, tab (group), image or indicator Owned by your own source code Private instance variable for CUiTestContainerView:CAknNavigationDecorator* iNaviDecorator; Include required header:#include <aknnavide.h> 	// Don’t use aknnavi.h! Cleanup in Destructor:delete iNaviDecorator; Andreas Jakl, 2008 41
Changing the Text Add this code to your own command handling(at some place where the descriptor still exists): Andreas Jakl, 2008 42 UiTestContainerView.cpp // Access the status pane of the AppUi CEikStatusPane* statusPane = iAvkonAppUi->StatusPane(); // Get the sub-pane, in our case the navigation pane CAknNavigationControlContainer* naviPane = static_cast<CAknNavigationControlContainer*> 			( statusPane->ControlL(TUid::Uid(EEikStatusPaneUidNavi)) ); if (iNaviDecorator) { // Delete the old navi decorator first – if we have already created one delete iNaviDecorator; iNaviDecorator = NULL;		// Don't forget this - see the memory management course! } // Create a new navigation label control, based on our buffer iNaviDecorator = naviPane->CreateNavigationLabelL(*buf); // Push the new decorator onto the navigation pane stack naviPane->PushL( *iNaviDecorator );
Dialogs Various types of Andreas Jakl, 2008 43
Dialogs? GUI application programming = managing controls and dialogs Dialog: Pop-up window Title 1+ buttons (dismiss the dialog) 1+ lines containing controls to display information Most dialogs are modal: foreground, get all user input until dismissed Andreas Jakl, 2008 44
Dialogs – Technical Overview Dialog = Control Displays information Allows user input Contains 1+ Controls Each line has a control Dialog class manages focus and sending key events! Derive from CAknDialog (S60: adds menu functionality) or CEikDialog Andreas Jakl, 2008 45
Dialog Classes (1) Andreas Jakl, 2008 46 Eikon CEikDialog Avkon CAknDialog CAknNoteDialog CAknQueryDialog CAknForm CEikDialog Base class for all dialogs Can be derived from for implementing custom dialogs
Example: Custom Dialog Manual creation of a dialog Helps to understand process behind the scenes Define the dialog contents in the resource file Create a class that handles the user input for the dialog Show the dialog to the user Andreas Jakl, 2008 47
General Requirements Additional Libraries: Andreas Jakl, 2008 48 These libraries arerequired by this example ... how to find that out? Take a look at the SDK documentation of theclasses we’ll use: CEikDialog, CEikEdwin
1. DIALOG resource Resource file defines general appearance and contents of each line of the dialog Andreas Jakl, 2008 49 UiTest.rss RESOURCE DIALOG r_dialog_test_dialog// Define the layout of the control { buttons = R_AVKON_SOFTKEYS_OK_CANCEL;		// Use S60 predefined softkeys for Ok and Cancel flags = EGeneralQueryFlags;				// Define the general behaviour and layout of the dialog (-> avkon.hrh) items = { DLG_LINE// The first dialog line: Text label { type=EEikCtLabel;					// Add a control of the type: label (Symbian OS generic) id=ESimpleDlgTextLabel;				// Each control has to have an ID (defined in .hrh) control=LABEL { txt="Enter text"; };		// Set parameters specific to the control specified in the “type” },								// Note: It’d be better to define the text in the .rls/.l01-file instead! DLG_LINE// Second dialog line: Text editor { type=EEikCtEdwin;				// Standard Symbian OS Editor-control id=ESimpleDlgText; control=EDWIN { width=10; maxlength=256; };	// Editor-specific settings } }; }
Resource Details: Dialog DIALOG is a STRUCT pre-defined in eikon.rh Andreas Jakl, 2008 50 eikon.rh STRUCT DIALOG { LONG flags=0;		// Characteristics of the dialog, e.g. EEikDialogFlagNoTitleBar LTEXT title="";		// Caption of the title bar (currently not used in S60) LLINK pages=0;		// For multipage-dialogs LLINK buttons=0;		// LLINK: Points to another resource. Use a predefined button/softkey-set or define your own (DLG_BUTTONS) STRUCT items[];		// Array of DLG_LINE-structures, specify contents of each dialog line LLINK form=0; } UiTest.rss RESOURCE DIALOG r_dialog_test_dialog { buttons = R_AVKON_SOFTKEYS_OK_CANCEL;		// Use S60 predefined softkeys for Ok and Cancel flags = EGeneralQueryFlags; items = { [...] }; } On S60 this gets expaned to:EEikDialogFlagWait | EEikDialogFlagNoDrag | EEikDialogFlagNoTitleBar | EEikDialogFlagCbaButtons
Resource Details: Items DLG_LINEs specify contained control and its options: Andreas Jakl, 2008 51 UiTest.rss DLG_LINE// The first dialog line: Text label { type=EEikCtLabel;					// Add a control of the type: label (Symbian OS generic) id=ESimpleDlgTextLabel;				// Each control has to have an ID (defined in .hrh) control=LABEL { txt="Enter text"; };		// Set parameters specific to the control specified in the “type” },								// Note: It’d be better to define the text in the .rls/.l01-file instead! DLG_LINE// Second dialog line: Text editor { type=EEikCtEdwin;				// Standard Symbian OS Editor-control id=ESimpleDlgText; control=EDWIN { width=10; maxlength=100; };	// Editor-specific settings } eikon.rh UiTest.hrh STRUCT EDWIN { LONG flags=0; WORD width=0; WORD lines=1; WORD maxlength=0; // #define that adds S60 specific extensions: AKN_EDITOR_EXTENSIONS } enumTUiTestIds { […]					// Command IDs, … ESimpleDlgTextLabel,	// Control ID for the label ESimpleDlgText// Control ID for the editor window };
2. Dialog Class Create an own class derived from CEikDialog Initializes controls Processes / saves control values when dismissed Andreas Jakl, 2008 52 SimpleDlg.h class CSimpleDlg : public CEikDialog{ public: CSimpleDlg(TDes& aText);		// Parameter: Pre-filled text for the editor control ~CSimpleDlg(); private:					// Inherited from CEikDialog void PreLayoutDynInitL();// Initialize dialog’s controls before the dialog is sized and laid out TBoolOkToExitL(TIntaKeycode);	// You can check entered content and decide if the user may leave the dialog private: TDes& iText;				// Save a reference to the text of the editor control };
Common Dialog Methods PreLayoutDynInit() Called by the framework before the dialog is sized and layed out Can be used to modify the layout or control contents OkToExit() Called by the framework when user dismisses a dialog using OK Extract data from dialog controls before it is destroyed Check user input for validity Dialog only closes if it returns ETrue Andreas Jakl, 2008 53
Class Initialization Constructor saves reference to the text buffer (pre-allocated by the caller) Control()-method of CEikDialog returns control of specified dialog line ( DLG_LINE) Casted to CEikEdwin , in this case to set the text Andreas Jakl, 2008 54 SimpleDlg.cpp CSimpleDlg::CSimpleDlg(TDes& aText) : iText(aText) {} void CSimpleDlg::PreLayoutDynInitL() { // Set the text of the editor window to something pre-defined STATIC_CAST(CEikEdwin*, Control(ESimpleDlgText))->SetTextL(&iText); }
Class Cleanup OkToExit() – only called when OK is selected Gives app. the chance to check values Get data from the dialog and save it somewhere Return ETrueif it’s ok to dismiss the dialog, EFalse otherwise Andreas Jakl, 2008 55 SimpleDlg.cpp CSimpleDlg::~CSimpleDlg() {} TBoolCSimpleDlg::OkToExitL(TIntaKeycode) { // Get the current text of the editor-control and save it to the text buffer STATIC_CAST(CEikEdwin*,Control(ESimpleDlgText))->GetText(iText); return ETrue;		// Could do some more checks here and return EFalse }
3. Launch the Dialog Important methods from the CEikDialog base class: PrepareLC(TIntaDialogResourceId) Constructs the dialog from the specified resource RunLD() Runs the dialog Returns how the user dismissed the dialog (button ID) Destroys the dialog on exit Returns when dialog exits for waiting dialogs or immediately for non-waiting dialogs (e.g. progress notes) ExecuteLD() Combination of PrepareLC() and RunLD() Andreas Jakl, 2008 56
Execution e.g. in the menu item handler function of the current View / AppUi Constructs the dialog, passes descriptor ExecuteLD() ReturnsETrue if OK is selected, EFalse for Cancel D in the class name hints that function will destroy this class after execution Pre-defined dialogs often put construction + execution into a single RunDlgLD()-method Andreas Jakl, 2008 57 Define iTmpText as instance variable in the AppUi, e.g. TBuf<100> DlgTestAppUi.cpp CSimpleDlg* dialog = new (ELeave) CSimpleDlg(iTmpTxt); dialog->ExecuteLD(R_DIALOG_TEST_DIALOG);
Dialog Classes (2) Andreas Jakl, 2008 58 Eikon CEikDialog Avkon CAknDialog CAknNoteDialog CAknQueryDialog CAknForm CAknDialog S60-specific Adds menu functionality to the standard dialog
Dialog Classes (3) Andreas Jakl, 2008 59 Eikon CEikDialog Avkon CAknDialog CAknNoteDialog CAknQueryDialog CAknForm CAknNoteDialog Displays information to the user Further derivation for: Wrapper classes (easier to use) Progress dialogs
Hands-on: Note Task: Display a confirmation note after the user selected the menu entry Andreas Jakl, 2008 60
Notes Inform the user about the current situation Text + graphical icon Displayed for set time, dismiss themselves Optional: sound To create a note, either: Use a Dialog derived from CAknNoteDialog Requires a DIALOG-resource in the .rss-file Use an AVKON (S60) defined wrapper class Resource predefined by AVKON  easier to use! Andreas Jakl, 2008 61
Notes Pre-defined notes; different durations, sounds, ...: CAknConfirmationNote Successfully completed process (e.g. settings saved) CAknInformationNote Inform the user about an unexpected situation (e.g. non-serious error) CAknWarningNote Warns the user of a situation that may require action (e.g. battery low) CAknErrorNote Warns the user of a situation that prevents processing to continue (e.g. wrong password)Use sparingly, prefer information notes Other note types: Progress Note, Wait Note(require resource definition) Andreas Jakl, 2008 62
Confirmation Note Show a confirmation note using the wrapper class: Similar code for other note types! Just use different wrapper classes Andreas Jakl, 2008 63 UiTestContainerView.cpp #include <aknnotewrappers.h> // Create a new confirmation note (pre-defined in S60 framework) CAknConfirmationNote* noteConfirm = new (ELeave) CAknConfirmationNote; // Displays and deletes the dialog – you don’t have to delete it yourself! noteConfirm->ExecuteLD(_L("Thank you!"));	// _L() for simplicity only – use dynamic text instead
Dialog Classes (4) Andreas Jakl, 2008 64 Eikon CEikDialog Avkon CAknDialog CAknNoteDialog CAknQueryDialog CAknForm CAknQueryDialog Handles user input Layout similar to notes, have to be dismissed by the user Further derivation for specialized input List-selection, confirmation, text, time, numbers, IP addresses, ...
Hands-on: Data Query Allow the user to enter his name: Andreas Jakl, 2008 65
Data Queries Enable various ways of user input Consist of a prompt and input editor(s) Several specialized data dialog classes defined in S60, e.g.: CAknTextQueryDialog: Text input CAknNumberQueryDialog: Allows entering a number CAknTimeQueryDialog: Time/Date Andreas Jakl, 2008 66
Defining the Data Query Andreas Jakl, 2008 67 UiTestContainer.hrh enumTUiTestContainerViewControls { ENameQueryDialogId = 1			// Define a unique id for each control in the dialog };						// ... important if you want to get a pointer to it in the source code UiTestContainer.rssi RESOURCE DIALOG r_ui_test_name_query { flags = EAknGeneralQueryFlags; buttons = R_AVKON_SOFTKEYS_OK_CANCEL;		// Softkeys to be displayed items = { DLG_LINE// Defines each line of a dialog – in this case the line is more complex {								// because the contained Avkon-control is made up of multiple lines itself type = EAknCtQuery;				// Type of the query id = ENameQueryDialogId;			// Unique ID, defined by yourself in .hrh-file control = AVKON_DATA_QUERY { layout = EDataLayout; label = STR_NameQuery;			// Text of the query, is put on a predefined label-control -> define in .l01! control = EDWIN// Define the editor window control { maxlength = 20;				// Maximum allowed input length default_input_mode = EAknEditorTextInputMode;	// Initial text input mode }; }; } }; }
Display the Data Query Andreas Jakl, 2008 68 UiTestContainerView.cpp // Define the descriptor that is to contain the user name TBuf<20> userName; // Create the text query dialog, giving it a reference to the descriptor that will contain the data CAknTextQueryDialog* txtDlg = CAknTextQueryDialog::NewL(userName); // You can modify the dialog from the source code. This enables the T9 input method. txtDlg->SetPredictiveTextInputPermitted(ETrue); // Execute and destroy the dialog – you don’t have to delete it yourself! if (txtDlg->ExecuteLD(R_UI_TEST_NAME_QUERY)) { // Copy the old contents of our command handling code in here, so that it’s only executed when the // user enters a name and doesn’t choose to cancel. }
Dialog Classes (5) Andreas Jakl, 2008 69 Eikon CEikDialog Avkon CAknDialog CAknNoteDialog CAknQueryDialog CAknForm CAknForm Dual mode: viewing and editing For collection of related data Special form of a dialog
Forms Two modes: View mode (= list box, highlight fields) Edit mode (edit fields) Default: Switch modes in options menu Multi-page Forms: Tabs to group relevant controls Andreas Jakl, 2008 70 View State Edit State Multi-page Forms
… let’s move to the Challenges! Try it for your own Andreas Jakl, 2008 71

More Related Content

Similar to Symbian OS - S60

Android application structure
Android application structureAndroid application structure
Android application structureAlexey Ustenko
 
Multi Lingual Websites In Umbraco
Multi Lingual Websites In UmbracoMulti Lingual Websites In Umbraco
Multi Lingual Websites In UmbracoPaul Marden
 
Software Development Automation With Scripting Languages
Software Development Automation With Scripting LanguagesSoftware Development Automation With Scripting Languages
Software Development Automation With Scripting LanguagesIonela
 
R12 d49656 gc10-apps dba 05
R12 d49656 gc10-apps dba 05R12 d49656 gc10-apps dba 05
R12 d49656 gc10-apps dba 05zeesniper
 
Software Internationalization Crash Course
Software Internationalization Crash CourseSoftware Internationalization Crash Course
Software Internationalization Crash CourseWill Iverson
 
(1) c sharp introduction_basics_dot_net
(1) c sharp introduction_basics_dot_net(1) c sharp introduction_basics_dot_net
(1) c sharp introduction_basics_dot_netNico Ludwig
 
Android App Development 08 : Support Multiple Devices
Android App Development 08 : Support Multiple DevicesAndroid App Development 08 : Support Multiple Devices
Android App Development 08 : Support Multiple DevicesAnuchit Chalothorn
 
Input and output in c
Input and output in cInput and output in c
Input and output in cRachana Joshi
 
Intro To Android App Development
Intro To Android App DevelopmentIntro To Android App Development
Intro To Android App DevelopmentMike Kvintus
 
Lec 4 06_aug [compatibility mode]
Lec 4 06_aug [compatibility mode]Lec 4 06_aug [compatibility mode]
Lec 4 06_aug [compatibility mode]Palak Sanghani
 
C:\Users\User\Desktop\Eclipse Infocenter
C:\Users\User\Desktop\Eclipse InfocenterC:\Users\User\Desktop\Eclipse Infocenter
C:\Users\User\Desktop\Eclipse InfocenterSuite Solutions
 
2.Android Platform_Theory.pptx
2.Android Platform_Theory.pptx2.Android Platform_Theory.pptx
2.Android Platform_Theory.pptxNizarnizarsurche
 
Automating API Documentation
Automating API DocumentationAutomating API Documentation
Automating API DocumentationSelvakumar T S
 
A First Look at Windows Presentation Foundation Everywhere (WPF/E): a Cross …
A First Look at Windows Presentation Foundation Everywhere (WPF/E): a Cross …A First Look at Windows Presentation Foundation Everywhere (WPF/E): a Cross …
A First Look at Windows Presentation Foundation Everywhere (WPF/E): a Cross …goodfriday
 
Industrial Training in Android Application
Industrial Training in Android ApplicationIndustrial Training in Android Application
Industrial Training in Android ApplicationArcadian Learning
 

Similar to Symbian OS - S60 (20)

Android application structure
Android application structureAndroid application structure
Android application structure
 
Ant tutorial
Ant tutorialAnt tutorial
Ant tutorial
 
Java ant tutorial
Java ant tutorialJava ant tutorial
Java ant tutorial
 
Multi Lingual Websites In Umbraco
Multi Lingual Websites In UmbracoMulti Lingual Websites In Umbraco
Multi Lingual Websites In Umbraco
 
Software Development Automation With Scripting Languages
Software Development Automation With Scripting LanguagesSoftware Development Automation With Scripting Languages
Software Development Automation With Scripting Languages
 
iphone presentation
iphone presentationiphone presentation
iphone presentation
 
R12 d49656 gc10-apps dba 05
R12 d49656 gc10-apps dba 05R12 d49656 gc10-apps dba 05
R12 d49656 gc10-apps dba 05
 
Software Internationalization Crash Course
Software Internationalization Crash CourseSoftware Internationalization Crash Course
Software Internationalization Crash Course
 
(1) c sharp introduction_basics_dot_net
(1) c sharp introduction_basics_dot_net(1) c sharp introduction_basics_dot_net
(1) c sharp introduction_basics_dot_net
 
PPT Companion to Android
PPT Companion to AndroidPPT Companion to Android
PPT Companion to Android
 
Android App Development 08 : Support Multiple Devices
Android App Development 08 : Support Multiple DevicesAndroid App Development 08 : Support Multiple Devices
Android App Development 08 : Support Multiple Devices
 
Input and output in c
Input and output in cInput and output in c
Input and output in c
 
Intro To Android App Development
Intro To Android App DevelopmentIntro To Android App Development
Intro To Android App Development
 
Lec 4 06_aug [compatibility mode]
Lec 4 06_aug [compatibility mode]Lec 4 06_aug [compatibility mode]
Lec 4 06_aug [compatibility mode]
 
C:\Users\User\Desktop\Eclipse Infocenter
C:\Users\User\Desktop\Eclipse InfocenterC:\Users\User\Desktop\Eclipse Infocenter
C:\Users\User\Desktop\Eclipse Infocenter
 
2.Android Platform_Theory.pptx
2.Android Platform_Theory.pptx2.Android Platform_Theory.pptx
2.Android Platform_Theory.pptx
 
Automating API Documentation
Automating API DocumentationAutomating API Documentation
Automating API Documentation
 
A First Look at Windows Presentation Foundation Everywhere (WPF/E): a Cross …
A First Look at Windows Presentation Foundation Everywhere (WPF/E): a Cross …A First Look at Windows Presentation Foundation Everywhere (WPF/E): a Cross …
A First Look at Windows Presentation Foundation Everywhere (WPF/E): a Cross …
 
Migrating JavaME Apps to Android
Migrating JavaME Apps to AndroidMigrating JavaME Apps to Android
Migrating JavaME Apps to Android
 
Industrial Training in Android Application
Industrial Training in Android ApplicationIndustrial Training in Android Application
Industrial Training in Android Application
 

More from Andreas Jakl

Create Engaging Healthcare Experiences with Augmented Reality
Create Engaging Healthcare Experiences with Augmented RealityCreate Engaging Healthcare Experiences with Augmented Reality
Create Engaging Healthcare Experiences with Augmented RealityAndreas Jakl
 
AR / VR Interaction Development with Unity
AR / VR Interaction Development with UnityAR / VR Interaction Development with Unity
AR / VR Interaction Development with UnityAndreas Jakl
 
Android Development with Kotlin, Part 3 - Code and App Management
Android Development with Kotlin, Part 3 - Code and App ManagementAndroid Development with Kotlin, Part 3 - Code and App Management
Android Development with Kotlin, Part 3 - Code and App ManagementAndreas Jakl
 
Android Development with Kotlin, Part 2 - Internet Services and JSON
Android Development with Kotlin, Part 2 - Internet Services and JSONAndroid Development with Kotlin, Part 2 - Internet Services and JSON
Android Development with Kotlin, Part 2 - Internet Services and JSONAndreas Jakl
 
Android Development with Kotlin, Part 1 - Introduction
Android Development with Kotlin, Part 1 - IntroductionAndroid Development with Kotlin, Part 1 - Introduction
Android Development with Kotlin, Part 1 - IntroductionAndreas Jakl
 
Android and NFC / NDEF (with Kotlin)
Android and NFC / NDEF (with Kotlin)Android and NFC / NDEF (with Kotlin)
Android and NFC / NDEF (with Kotlin)Andreas Jakl
 
Basics of Web Technologies
Basics of Web TechnologiesBasics of Web Technologies
Basics of Web TechnologiesAndreas Jakl
 
Bluetooth Beacons - Bluetooth 5, iBeacon, Eddystone, Arduino, Windows 10 & More
Bluetooth Beacons - Bluetooth 5, iBeacon, Eddystone, Arduino, Windows 10 & MoreBluetooth Beacons - Bluetooth 5, iBeacon, Eddystone, Arduino, Windows 10 & More
Bluetooth Beacons - Bluetooth 5, iBeacon, Eddystone, Arduino, Windows 10 & MoreAndreas Jakl
 
Which new scenarios are enabled by Windows 10 for NFC, Bluetooth LE & Beacons?
Which new scenarios are enabled by Windows 10 for NFC, Bluetooth LE & Beacons?Which new scenarios are enabled by Windows 10 for NFC, Bluetooth LE & Beacons?
Which new scenarios are enabled by Windows 10 for NFC, Bluetooth LE & Beacons?Andreas Jakl
 
Mobile Test Automation
Mobile Test AutomationMobile Test Automation
Mobile Test AutomationAndreas Jakl
 
Qt App Development - Cross-Platform Development for Android, iOS, Windows Pho...
Qt App Development - Cross-Platform Development for Android, iOS, Windows Pho...Qt App Development - Cross-Platform Development for Android, iOS, Windows Pho...
Qt App Development - Cross-Platform Development for Android, iOS, Windows Pho...Andreas Jakl
 
WinJS, Apache Cordova & NFC - HTML5 apps for Android and Windows Phone
WinJS, Apache Cordova & NFC - HTML5 apps for Android and Windows PhoneWinJS, Apache Cordova & NFC - HTML5 apps for Android and Windows Phone
WinJS, Apache Cordova & NFC - HTML5 apps for Android and Windows PhoneAndreas Jakl
 
Nokia New Asha Platform Developer Training
Nokia New Asha Platform Developer TrainingNokia New Asha Platform Developer Training
Nokia New Asha Platform Developer TrainingAndreas Jakl
 
Windows Phone 8 NFC Quickstart
Windows Phone 8 NFC QuickstartWindows Phone 8 NFC Quickstart
Windows Phone 8 NFC QuickstartAndreas Jakl
 
Windows (Phone) 8 NFC App Scenarios
Windows (Phone) 8 NFC App ScenariosWindows (Phone) 8 NFC App Scenarios
Windows (Phone) 8 NFC App ScenariosAndreas Jakl
 
Windows 8 Platform NFC Development
Windows 8 Platform NFC DevelopmentWindows 8 Platform NFC Development
Windows 8 Platform NFC DevelopmentAndreas Jakl
 
NFC Development with Qt - v2.2.0 (5. November 2012)
NFC Development with Qt - v2.2.0 (5. November 2012)NFC Development with Qt - v2.2.0 (5. November 2012)
NFC Development with Qt - v2.2.0 (5. November 2012)Andreas Jakl
 
06 - Qt Communication
06 - Qt Communication06 - Qt Communication
06 - Qt CommunicationAndreas Jakl
 
05 - Qt External Interaction and Graphics
05 - Qt External Interaction and Graphics05 - Qt External Interaction and Graphics
05 - Qt External Interaction and GraphicsAndreas Jakl
 

More from Andreas Jakl (20)

Create Engaging Healthcare Experiences with Augmented Reality
Create Engaging Healthcare Experiences with Augmented RealityCreate Engaging Healthcare Experiences with Augmented Reality
Create Engaging Healthcare Experiences with Augmented Reality
 
AR / VR Interaction Development with Unity
AR / VR Interaction Development with UnityAR / VR Interaction Development with Unity
AR / VR Interaction Development with Unity
 
Android Development with Kotlin, Part 3 - Code and App Management
Android Development with Kotlin, Part 3 - Code and App ManagementAndroid Development with Kotlin, Part 3 - Code and App Management
Android Development with Kotlin, Part 3 - Code and App Management
 
Android Development with Kotlin, Part 2 - Internet Services and JSON
Android Development with Kotlin, Part 2 - Internet Services and JSONAndroid Development with Kotlin, Part 2 - Internet Services and JSON
Android Development with Kotlin, Part 2 - Internet Services and JSON
 
Android Development with Kotlin, Part 1 - Introduction
Android Development with Kotlin, Part 1 - IntroductionAndroid Development with Kotlin, Part 1 - Introduction
Android Development with Kotlin, Part 1 - Introduction
 
Android and NFC / NDEF (with Kotlin)
Android and NFC / NDEF (with Kotlin)Android and NFC / NDEF (with Kotlin)
Android and NFC / NDEF (with Kotlin)
 
Basics of Web Technologies
Basics of Web TechnologiesBasics of Web Technologies
Basics of Web Technologies
 
Bluetooth Beacons - Bluetooth 5, iBeacon, Eddystone, Arduino, Windows 10 & More
Bluetooth Beacons - Bluetooth 5, iBeacon, Eddystone, Arduino, Windows 10 & MoreBluetooth Beacons - Bluetooth 5, iBeacon, Eddystone, Arduino, Windows 10 & More
Bluetooth Beacons - Bluetooth 5, iBeacon, Eddystone, Arduino, Windows 10 & More
 
Which new scenarios are enabled by Windows 10 for NFC, Bluetooth LE & Beacons?
Which new scenarios are enabled by Windows 10 for NFC, Bluetooth LE & Beacons?Which new scenarios are enabled by Windows 10 for NFC, Bluetooth LE & Beacons?
Which new scenarios are enabled by Windows 10 for NFC, Bluetooth LE & Beacons?
 
Mobile Test Automation
Mobile Test AutomationMobile Test Automation
Mobile Test Automation
 
Qt App Development - Cross-Platform Development for Android, iOS, Windows Pho...
Qt App Development - Cross-Platform Development for Android, iOS, Windows Pho...Qt App Development - Cross-Platform Development for Android, iOS, Windows Pho...
Qt App Development - Cross-Platform Development for Android, iOS, Windows Pho...
 
WinJS, Apache Cordova & NFC - HTML5 apps for Android and Windows Phone
WinJS, Apache Cordova & NFC - HTML5 apps for Android and Windows PhoneWinJS, Apache Cordova & NFC - HTML5 apps for Android and Windows Phone
WinJS, Apache Cordova & NFC - HTML5 apps for Android and Windows Phone
 
Nokia New Asha Platform Developer Training
Nokia New Asha Platform Developer TrainingNokia New Asha Platform Developer Training
Nokia New Asha Platform Developer Training
 
Windows Phone 8 NFC Quickstart
Windows Phone 8 NFC QuickstartWindows Phone 8 NFC Quickstart
Windows Phone 8 NFC Quickstart
 
Windows (Phone) 8 NFC App Scenarios
Windows (Phone) 8 NFC App ScenariosWindows (Phone) 8 NFC App Scenarios
Windows (Phone) 8 NFC App Scenarios
 
Windows 8 Platform NFC Development
Windows 8 Platform NFC DevelopmentWindows 8 Platform NFC Development
Windows 8 Platform NFC Development
 
NFC Development with Qt - v2.2.0 (5. November 2012)
NFC Development with Qt - v2.2.0 (5. November 2012)NFC Development with Qt - v2.2.0 (5. November 2012)
NFC Development with Qt - v2.2.0 (5. November 2012)
 
06 - Qt Communication
06 - Qt Communication06 - Qt Communication
06 - Qt Communication
 
05 - Qt External Interaction and Graphics
05 - Qt External Interaction and Graphics05 - Qt External Interaction and Graphics
05 - Qt External Interaction and Graphics
 
04 - Qt Data
04 - Qt Data04 - Qt Data
04 - Qt Data
 

Recently uploaded

My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clashcharlottematthew16
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024The Digital Insurer
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostZilliz
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Wonjun Hwang
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr LapshynFwdays
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo García Lavilla
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 

Recently uploaded (20)

My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clash
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 

Symbian OS - S60

  • 1. Symbian OS UI-Development for S60 1 Andreas Jakl, 2008 v2.0b – 20 January 2009
  • 2. Disclaimer These slides are provided free of charge at http://www.symbianresources.com and are used during Symbian OS courses at the University of Applied Sciences in Hagenberg, Austria ( http://www.fh-hagenberg.at/ ) Respecting the copyright laws, you are allowed to use them: for your own, personal, non-commercial use in the academic environment In all other cases (e.g. for commercial training), please contact andreas.jakl@fh-hagenberg.at The correctness of the contents of these materials cannot be guaranteed. Andreas Jakl is not liable for incorrect information or damage that may arise from using the materials. Parts of these materials are based on information from Symbian Press-books published by John Wiley & Sons, Ltd. This document contains copyright materials which are proprietary to Symbian, UIQ, Nokia and SonyEricsson. “S60™” is a trademark of Nokia. “UIQ™” is a trademark of UIQ Technology. Pictures of mobile phones or applications are copyright their respective manufacturers / developers. “Symbian ™”, “Symbian OS ™” and all other Symbian-based marks and logos are trademarks of Symbian Software Limited and are used under license. © Symbian Software Limited 2006. Andreas Jakl, 2008 2
  • 3. Contents S60 UI Overview Resource Files andLocalization Defining Menus Loading Strings fromResource Files Label Controls Modifyingthe Status Pane Dialogs Overview Custom Dialog Notes Query Dialogs Andreas Jakl, 2008 3
  • 4. S60 UI Elements of the Andreas Jakl, 2008 4
  • 5. UI-Components Window Sub-component of the device screen Principal window filling up entire screen Not used for display Can contain many panes Pane Sub-component of a window Can contain many sub-panes Andreas Jakl, 2008 5
  • 6. S60 UI Status Pane Information about running application & device (e.g. battery strength) Main Pane Application content Control Pane Softkey labels Andreas Jakl, 2008 6 Status Pane Main Pane Control Pane
  • 7. Status Pane Usually contains of sub-panes: Title pane Context pane Navigation pane Signal pane Battery pane Automatically generated by AppUi Andreas Jakl, 2008 7 Batterypane /Universalindicatorpane Title pane Contextpane Navipane Signal pane
  • 8. Navigation Pane Either empty or “decorated” with controls: Tabs Indicate different pages (= views) Navigation label Optional: Text on a tab Navigation image Optional: Image on a tab Indicators State of important element, e.g. volume Custom Controls Any CCoeControl-derived object Andreas Jakl, 2008 8
  • 9. Resource Files Define your UI Andreas Jakl, 2008 9
  • 10. Resource Files Separate UI-elements from code Define: User Interface (Menus, Dialogs, Lists) (Localizable) Text Application Information Advantages: Information only loaded when needed (save RAM) Localizable Can be compressed Andreas Jakl, 2008 10
  • 11. Applications & Resources App. has to have <AppName>.rss Can optionally use multiple resource files Resource files have their own syntax! .rss-files compiled to .rsc + .rsg (= header) C++ code references resources by including .rsg-files Andreas Jakl, 2008 11
  • 12. Typical Logical Structure Andreas Jakl, 2008 12 When your application is localized, use .lxx files or several .rls-filesto provide localized strings. The number specifies the location code (e.g. 03 = German) <AppName>_reg.rss Application Information <AppName>_reg.rsg Resource header output from resource compiler <AppName>_reg.rsc / r01... Compiled resource file <AppName>.rls / l01... Localisable strings, included from .rss Resource Compiler <AppName>.rss Main resource file Contains UI-definitions, literals <AppName>.rsg <AppName>.hrh Resource Header, usually contains command IDs for menus, ... <AppName>.rsc / r01...
  • 13. File Type Overview Resource files and their meaning: Andreas Jakl, 2008 13 Two different possible naming conventions
  • 14. Resource File Format Consist of (multiple) data constructs with uppercase keywords STRUCT keyword Sequence of items, each with name and data type Not often needed directly Andreas Jakl, 2008 14 Name Keyword STRUCT MYDATA { WORD value=0; LTEXT main_text; LTEXT text_items[]; } Data Type Items
  • 15. Resource File Format RESOURCE-keyword Creates an instance of a STRUCT Assigns values to its items Predefined STRUCTs from Symbian OS / S60 / UIQ for UI-definitions, Strings, ... Andreas Jakl, 2008 15 // Creates an instanceof STRUCT fromthepreviousslide RESOURCE MYDATA r_mydata_res{ value=3; main_text="sometextstring"; text_items={"item 1", "item 2"}; }
  • 16. Resource File Structure Compulsory content of the main resource file: Andreas Jakl, 2008 16 HelloWorld.rss NAME HELO // 4 letter resource id [ ... includes ... ] // Resource compiler handles includes like the C++ compiler #include "DialogTest.hrh" // Defines enumerated constants for the application’s commands #include "DialogTest.rls" // (or .loc) – defines strings used in the UI. RESOURCE RSS_SIGNATURE { } // optional version info RESOURCE TBUF { buf = ""; } // can specify doc file – here: unused -> blank RESOURCE EIK_APP_INFO r_application_dialog_test_app_ui { cba = R_AVKON_SOFTKEYS_OPTIONS_EXIT; // Softkey-definition (S60 predefined) status_pane = r_application_status_pane; // App-wide status pane (defined below in .rss) } STRUCTs are defined in eikon.rh
  • 17. String Resources Define text in one place – and not in the source code Easy to modify, easy to localize Andreas Jakl, 2008 17 <AppName>.rls / .l01... (Text only!) rls_stringSTR_Loading “Loading...” rls_stringSTR_Caption “Hello World” <Program>.cpp(C++ Source Code) #include <stringloader.h> #include <<AppName>.rsg> void C<AppName>AppUi::DisplayInfo() { HBufC* buf = StringLoader::LoadLC ( R_LOADING ); [...] CleanupStack::PopAndDestroy(buf); } <AppName>.rss(UI Definition) #include “<AppName>.rls” RESOURCE LOCALISABLE_APP_INFO r_localisable_app_info { short_caption = STR_Caption; } RESOURCE TBUF r_loading { buf = STR_Loading; } [...] <AppName>.rsg(Generated by resource compiler) #define R_LOCALISABLE_APP_INFO 0x66a61005 #define R_LOADING 0x66a61006
  • 18. Localization Resource files compiled multiple times, once for each language Supported languages defined in .mmp Current language set by compiler using #define Andreas Jakl, 2008 18 Journey.mmp START RESOURCE Journey.rss HEADER TARGETPATH resourcepps LANG 01 03 END Journey.loc Two common naming conventions: 1.) .loc as junction & .l01... for each language 2.) .rls as junction & Journey_01.rls... for each language #ifdef LANGUAGE_01 #include “journey.l01” // UK English #elif defined LANGUAGE_03 #include “journey.l03” // German #else #include “journey.l01” // Default to UK English #endif
  • 19. <AppName>.loc Include currently active language #ifdef LANGUAGE_01... <AppName>.r01 UK English compiled resource file <AppName>.r02 French compiled resource file Resource Compiler <AppName>.rss Strings replaced with #defines from currently active .lxx <AppName>.r03 German compiled resource file Localization – Overview Andreas Jakl, 2008 19 If using .rls-files instead of .loc, use rls_string instead of #define <AppName>.l01 UK English #define STR_hi “Hello” <AppName>.l02 French #define STR_hi “Salut” <AppName>.l03 German #define STR_hi “Hallo”
  • 20. Localized Installation Usually: All languages contained in .sis-file Only language matching phone language is installed .pkg-file defines which resource files to install for which language (all other files won’t be installed) Installed resource-file renamed from .r01/.rxx to .rsc Andreas Jakl, 2008 20 Journey.pkg &EN,GE// Defines which languages are available [...] { "ymbian.160_3rd_MRpoc32ataesourceppsourney.r01" "ymbian.160_3rd_MRpoc32ataesourceppsourney.r03“ } -"!:esourceppsourney.rsc“ // Only current phone language will get installed!
  • 21. Internationalisation? ... it’s a lot more than translating text! Symbian OS: Locale Settings API Andreas Jakl, 2008 21
  • 22. UI-Elements Defining and using Andreas Jakl, 2008 22
  • 23. Menus Menu Bar Defines title of the menu(not shown in S60) and the contained menu panes (usually 1) Can be default for Application orindividual for each view Menu Pane Defines unique section of a menu Contains menu items, each with text string and command id Andreas Jakl, 2008 23 Menu Pane Menu Bar
  • 24. Hierarchical Structure Andreas Jakl, 2008 24 AVKON_VIEW EIK_APP_INFO Menu Bar can be part of a specific viewor of the general application MENU_BAR Menu Bar contains n Menu Panes MENU_PANE MENU_PANE MENU_ITEM (s): MENU_ITEM (s)
  • 25. Hands-On: Menu Create a new project: Name: “UiTest” Template: “S60 GUI Application with UI Designer” Design: Empty Andreas Jakl, 2008 25 We won’t use the UI designer in this example, but the wizard creates a view-based architecture WARNING: Do not use the UI-Designer in this example, as it would override some of our own source code! We want to do this in the first step...
  • 26. Defining your menu Define the menu text in the .l01-file Define the menu command ids in the .hrh-file Andreas Jakl, 2008 26 UiTestContainer.l01 #define STR_ShowYourName "Show your name" #define STR_Exit "Exit" UiTestContainer.hrh enumTUiTestContainerViewCommands { EUiTestCmdShowYourName = 0x6000, // Any number that isn’t 0 EUiTestCmdExit// … enum automatically counts upwards }; Create this file in the inc-folder of your project
  • 27. Menu Definition? Menu command in the .hrh-file: Used in menu definition (.rss) Used for checking which menu item was selected (<View>.cpp) Andreas Jakl, 2008 27 .hrh Defines menu command ids .rssUses command ids in menu item definition <View>.cpp Checks selected menu item in HandleCommandL()
  • 28. Defining your menu Create the menu in the .rss(i) file Andreas Jakl, 2008 28 UiTestContainer.rssi #include "UiTestContainer.hrh" // Add this at the beginning so that the command id is known RESOURCE AVKON_VIEW r_ui_test_container_ui_test_container_view { cba = R_AVKON_SOFTKEYS_OPTIONS_EXIT; menubar = r_ui_test_container_options_menu; } RESOURCE MENU_BAR r_ui_test_container_options_menu { titles = { MENU_TITLE { txt = "Example Menu"; menu_pane = r_ui_test_container_menu_pane; } }; } RESOURCE MENU_PANE r_ui_test_container_menu_pane { items = { MENU_ITEM { command = EUiTestCmdShowYourName; txt = STR_ShowYourName; }, MENU_ITEM { command = EUiTestCmdExit; txt = STR_Exit; } }; } [...]
  • 29. Menu Definition? AVKON_VIEW (S60 View-Architecture) CBA: Defines Softkey labels In this case Symbian OS standard-values (Options / Exit) MENU_BAR Defines contained menu panes and their titles MENU_PANE Defines individual items Uses command ids from .hrh-file and text from .loc Andreas Jakl, 2008 29
  • 30. Handling Commands View-based architecture, events are sent to: HandleCommandL() of the current view If unhandled, HandleCommandL() of the AppUi Andreas Jakl, 2008 30 UiTestContainerView.cpp #include "UiTestContainer.hrh" void CUiTestContainerView::HandleCommandL( TIntaCommand ) { TBoolcommandHandled = EFalse; switch ( aCommand ) { case EUiTestCmdExit: // Exit the application when our new menu item is selected AppUi()->HandleCommandL( EEikCmdExit ); break; default: break; } […] } Pre-defined system command. App. has to quit in any case, without a user query (e.g. forced shutdown)
  • 31. Hands-On: Loading Strings Task: Load a String from a resource file and display it in a Label-control Andreas Jakl, 2008 31
  • 32. Strings? Hard-coding strings in source code: ... that’s bad! Why? Difficult to find and change later on No clear application structure(mix source code with text) Not localizable Andreas Jakl, 2008 32 // Defining literals with the _LIT-macro _LIT(msg, “Loading…”); // The deprecated _L-macro iEikonEnv->AlertWin(_L(“Starting…”));
  • 33. Adding a Label-Control Label-Control declared in <eiklabel.h> (see SDK-help for CEikLabel – it’s a Symbian OS control!) Define as private member of UiTestContainer.h:CEikLabel* iLabelName; Initialization code: Andreas Jakl, 2008 33 UiTestContainer.cpp void CUiTestContainer::ConstructL (…) { […] iLabelName = new (ELeave) CEikLabel(); iLabelName->SetContainerWindowL( *this ); // Label is non-window-owning iLabelName->SetTextL(KNullDesC); // Initially no text iLabelName->SetAlignment( EHCenterVCenter ); // Align the text in the center iLabelName->SetExtentToWholeScreen(); // Set the size and position […] } CUiTestContainer::~CUiTestContainer() { delete iLabelName; // Don’t forget to delete the label! }
  • 34. Control-Management The Container has to manage the controls ( see “GUI Architectures” module) Wizard generates “old”, manual control-management Add the new label to the enum-control-counter Adapt the ComponentControl()-function Andreas Jakl, 2008 34 UiTestContainer.h enumTControls { ELabelName, ELastControl }; UiTestContainer.cpp CCoeControl* CUiTestContainer::ComponentControl( TIntaIndex ) const { switch ( aIndex ) { case ELabelName: return iLabelName; break; }
  • 35. Modifying the Label-Text Create a function to modify the label text (define in .h) Define a text as a string resource... this allows you to load the text (defined in .l01) into a descriptor from within the source code Andreas Jakl, 2008 35 UiTestContainer.cpp void CUiTestContainer::SetLabelTextL( const TDesC& aText ) { iLabelName->SetTextL(aText); // Update the text of the label DrawDeferred(); // Request a screen redraw } UiTestContainer.rssi RESOURCE TBUF r_labeltext { buf = STR_ShowYourName; }
  • 36. Executing the Text-Change In CUiTestContainerView::HandleCommandL() for the other menu item: Use the StringLoader to load the text into a HBufC and call the iUiTestContainer->SetLabelTextL()-function (see Slide 17) Dereference the HBufC with a * when using it as a TDesC& parameter Andreas Jakl, 2008 36
  • 37. Hands-on: Dynamic Menu Task: Change menu content depending on app. state Andreas Jakl, 2008 37
  • 38. Dynamic Menu New TBool instance variable: iLabelTextSet Define it in UiTestContainerView (Default: EFalse) Set to ETrue when menu item is selected Override menu init-function from view base class Called after menu is read from resource file, but before it is displayed Andreas Jakl, 2008 38 UiTestContainerView.cpp void CUiTestContainerView::DynInitMenuPaneL(TIntaResourceId, CEikMenuPane* aMenuPane) { // Check if the menu pane that is initialized is the one we are waiting for if (aResourceId == R_UI_TEST_CONTAINER_MENU_PANE) { // Dim the item depending on the application state aMenuPane->SetItemDimmed(EUiTestCmdShowYourName, iLabelTextSet); } }
  • 39. Hands-on: Navigation Pane Dynamically modify the S60 Navigation Pane Andreas Jakl, 2008 39
  • 40. Accessing the Pane Access the status pane: ... in the AppUi:CEikStatusPane* sp = StatusPane(); ... in an Avkon View:CEikStatusPane* sp = iAvkonAppUi->StatusPane(); ... in most other places:CEikStatusPane* sp = iEikonEnv->AppUiFactory() ->StatusPane(); ... for the rest:CEikStatusPane* sp = CEikonEnv::Static() ->AppUiFactory()->StatusPane(); Access the required sub-pane (Title, Navigation, ...) Andreas Jakl, 2008 40
  • 41. Navigation Decorator Navigation Decorator is a control (CCoeControl) Options: label, tab (group), image or indicator Owned by your own source code Private instance variable for CUiTestContainerView:CAknNavigationDecorator* iNaviDecorator; Include required header:#include <aknnavide.h> // Don’t use aknnavi.h! Cleanup in Destructor:delete iNaviDecorator; Andreas Jakl, 2008 41
  • 42. Changing the Text Add this code to your own command handling(at some place where the descriptor still exists): Andreas Jakl, 2008 42 UiTestContainerView.cpp // Access the status pane of the AppUi CEikStatusPane* statusPane = iAvkonAppUi->StatusPane(); // Get the sub-pane, in our case the navigation pane CAknNavigationControlContainer* naviPane = static_cast<CAknNavigationControlContainer*> ( statusPane->ControlL(TUid::Uid(EEikStatusPaneUidNavi)) ); if (iNaviDecorator) { // Delete the old navi decorator first – if we have already created one delete iNaviDecorator; iNaviDecorator = NULL; // Don't forget this - see the memory management course! } // Create a new navigation label control, based on our buffer iNaviDecorator = naviPane->CreateNavigationLabelL(*buf); // Push the new decorator onto the navigation pane stack naviPane->PushL( *iNaviDecorator );
  • 43. Dialogs Various types of Andreas Jakl, 2008 43
  • 44. Dialogs? GUI application programming = managing controls and dialogs Dialog: Pop-up window Title 1+ buttons (dismiss the dialog) 1+ lines containing controls to display information Most dialogs are modal: foreground, get all user input until dismissed Andreas Jakl, 2008 44
  • 45. Dialogs – Technical Overview Dialog = Control Displays information Allows user input Contains 1+ Controls Each line has a control Dialog class manages focus and sending key events! Derive from CAknDialog (S60: adds menu functionality) or CEikDialog Andreas Jakl, 2008 45
  • 46. Dialog Classes (1) Andreas Jakl, 2008 46 Eikon CEikDialog Avkon CAknDialog CAknNoteDialog CAknQueryDialog CAknForm CEikDialog Base class for all dialogs Can be derived from for implementing custom dialogs
  • 47. Example: Custom Dialog Manual creation of a dialog Helps to understand process behind the scenes Define the dialog contents in the resource file Create a class that handles the user input for the dialog Show the dialog to the user Andreas Jakl, 2008 47
  • 48. General Requirements Additional Libraries: Andreas Jakl, 2008 48 These libraries arerequired by this example ... how to find that out? Take a look at the SDK documentation of theclasses we’ll use: CEikDialog, CEikEdwin
  • 49. 1. DIALOG resource Resource file defines general appearance and contents of each line of the dialog Andreas Jakl, 2008 49 UiTest.rss RESOURCE DIALOG r_dialog_test_dialog// Define the layout of the control { buttons = R_AVKON_SOFTKEYS_OK_CANCEL; // Use S60 predefined softkeys for Ok and Cancel flags = EGeneralQueryFlags; // Define the general behaviour and layout of the dialog (-> avkon.hrh) items = { DLG_LINE// The first dialog line: Text label { type=EEikCtLabel; // Add a control of the type: label (Symbian OS generic) id=ESimpleDlgTextLabel; // Each control has to have an ID (defined in .hrh) control=LABEL { txt="Enter text"; }; // Set parameters specific to the control specified in the “type” }, // Note: It’d be better to define the text in the .rls/.l01-file instead! DLG_LINE// Second dialog line: Text editor { type=EEikCtEdwin; // Standard Symbian OS Editor-control id=ESimpleDlgText; control=EDWIN { width=10; maxlength=256; }; // Editor-specific settings } }; }
  • 50. Resource Details: Dialog DIALOG is a STRUCT pre-defined in eikon.rh Andreas Jakl, 2008 50 eikon.rh STRUCT DIALOG { LONG flags=0; // Characteristics of the dialog, e.g. EEikDialogFlagNoTitleBar LTEXT title=""; // Caption of the title bar (currently not used in S60) LLINK pages=0; // For multipage-dialogs LLINK buttons=0; // LLINK: Points to another resource. Use a predefined button/softkey-set or define your own (DLG_BUTTONS) STRUCT items[]; // Array of DLG_LINE-structures, specify contents of each dialog line LLINK form=0; } UiTest.rss RESOURCE DIALOG r_dialog_test_dialog { buttons = R_AVKON_SOFTKEYS_OK_CANCEL; // Use S60 predefined softkeys for Ok and Cancel flags = EGeneralQueryFlags; items = { [...] }; } On S60 this gets expaned to:EEikDialogFlagWait | EEikDialogFlagNoDrag | EEikDialogFlagNoTitleBar | EEikDialogFlagCbaButtons
  • 51. Resource Details: Items DLG_LINEs specify contained control and its options: Andreas Jakl, 2008 51 UiTest.rss DLG_LINE// The first dialog line: Text label { type=EEikCtLabel; // Add a control of the type: label (Symbian OS generic) id=ESimpleDlgTextLabel; // Each control has to have an ID (defined in .hrh) control=LABEL { txt="Enter text"; }; // Set parameters specific to the control specified in the “type” }, // Note: It’d be better to define the text in the .rls/.l01-file instead! DLG_LINE// Second dialog line: Text editor { type=EEikCtEdwin; // Standard Symbian OS Editor-control id=ESimpleDlgText; control=EDWIN { width=10; maxlength=100; }; // Editor-specific settings } eikon.rh UiTest.hrh STRUCT EDWIN { LONG flags=0; WORD width=0; WORD lines=1; WORD maxlength=0; // #define that adds S60 specific extensions: AKN_EDITOR_EXTENSIONS } enumTUiTestIds { […] // Command IDs, … ESimpleDlgTextLabel, // Control ID for the label ESimpleDlgText// Control ID for the editor window };
  • 52. 2. Dialog Class Create an own class derived from CEikDialog Initializes controls Processes / saves control values when dismissed Andreas Jakl, 2008 52 SimpleDlg.h class CSimpleDlg : public CEikDialog{ public: CSimpleDlg(TDes& aText); // Parameter: Pre-filled text for the editor control ~CSimpleDlg(); private: // Inherited from CEikDialog void PreLayoutDynInitL();// Initialize dialog’s controls before the dialog is sized and laid out TBoolOkToExitL(TIntaKeycode); // You can check entered content and decide if the user may leave the dialog private: TDes& iText; // Save a reference to the text of the editor control };
  • 53. Common Dialog Methods PreLayoutDynInit() Called by the framework before the dialog is sized and layed out Can be used to modify the layout or control contents OkToExit() Called by the framework when user dismisses a dialog using OK Extract data from dialog controls before it is destroyed Check user input for validity Dialog only closes if it returns ETrue Andreas Jakl, 2008 53
  • 54. Class Initialization Constructor saves reference to the text buffer (pre-allocated by the caller) Control()-method of CEikDialog returns control of specified dialog line ( DLG_LINE) Casted to CEikEdwin , in this case to set the text Andreas Jakl, 2008 54 SimpleDlg.cpp CSimpleDlg::CSimpleDlg(TDes& aText) : iText(aText) {} void CSimpleDlg::PreLayoutDynInitL() { // Set the text of the editor window to something pre-defined STATIC_CAST(CEikEdwin*, Control(ESimpleDlgText))->SetTextL(&iText); }
  • 55. Class Cleanup OkToExit() – only called when OK is selected Gives app. the chance to check values Get data from the dialog and save it somewhere Return ETrueif it’s ok to dismiss the dialog, EFalse otherwise Andreas Jakl, 2008 55 SimpleDlg.cpp CSimpleDlg::~CSimpleDlg() {} TBoolCSimpleDlg::OkToExitL(TIntaKeycode) { // Get the current text of the editor-control and save it to the text buffer STATIC_CAST(CEikEdwin*,Control(ESimpleDlgText))->GetText(iText); return ETrue; // Could do some more checks here and return EFalse }
  • 56. 3. Launch the Dialog Important methods from the CEikDialog base class: PrepareLC(TIntaDialogResourceId) Constructs the dialog from the specified resource RunLD() Runs the dialog Returns how the user dismissed the dialog (button ID) Destroys the dialog on exit Returns when dialog exits for waiting dialogs or immediately for non-waiting dialogs (e.g. progress notes) ExecuteLD() Combination of PrepareLC() and RunLD() Andreas Jakl, 2008 56
  • 57. Execution e.g. in the menu item handler function of the current View / AppUi Constructs the dialog, passes descriptor ExecuteLD() ReturnsETrue if OK is selected, EFalse for Cancel D in the class name hints that function will destroy this class after execution Pre-defined dialogs often put construction + execution into a single RunDlgLD()-method Andreas Jakl, 2008 57 Define iTmpText as instance variable in the AppUi, e.g. TBuf<100> DlgTestAppUi.cpp CSimpleDlg* dialog = new (ELeave) CSimpleDlg(iTmpTxt); dialog->ExecuteLD(R_DIALOG_TEST_DIALOG);
  • 58. Dialog Classes (2) Andreas Jakl, 2008 58 Eikon CEikDialog Avkon CAknDialog CAknNoteDialog CAknQueryDialog CAknForm CAknDialog S60-specific Adds menu functionality to the standard dialog
  • 59. Dialog Classes (3) Andreas Jakl, 2008 59 Eikon CEikDialog Avkon CAknDialog CAknNoteDialog CAknQueryDialog CAknForm CAknNoteDialog Displays information to the user Further derivation for: Wrapper classes (easier to use) Progress dialogs
  • 60. Hands-on: Note Task: Display a confirmation note after the user selected the menu entry Andreas Jakl, 2008 60
  • 61. Notes Inform the user about the current situation Text + graphical icon Displayed for set time, dismiss themselves Optional: sound To create a note, either: Use a Dialog derived from CAknNoteDialog Requires a DIALOG-resource in the .rss-file Use an AVKON (S60) defined wrapper class Resource predefined by AVKON  easier to use! Andreas Jakl, 2008 61
  • 62. Notes Pre-defined notes; different durations, sounds, ...: CAknConfirmationNote Successfully completed process (e.g. settings saved) CAknInformationNote Inform the user about an unexpected situation (e.g. non-serious error) CAknWarningNote Warns the user of a situation that may require action (e.g. battery low) CAknErrorNote Warns the user of a situation that prevents processing to continue (e.g. wrong password)Use sparingly, prefer information notes Other note types: Progress Note, Wait Note(require resource definition) Andreas Jakl, 2008 62
  • 63. Confirmation Note Show a confirmation note using the wrapper class: Similar code for other note types! Just use different wrapper classes Andreas Jakl, 2008 63 UiTestContainerView.cpp #include <aknnotewrappers.h> // Create a new confirmation note (pre-defined in S60 framework) CAknConfirmationNote* noteConfirm = new (ELeave) CAknConfirmationNote; // Displays and deletes the dialog – you don’t have to delete it yourself! noteConfirm->ExecuteLD(_L("Thank you!")); // _L() for simplicity only – use dynamic text instead
  • 64. Dialog Classes (4) Andreas Jakl, 2008 64 Eikon CEikDialog Avkon CAknDialog CAknNoteDialog CAknQueryDialog CAknForm CAknQueryDialog Handles user input Layout similar to notes, have to be dismissed by the user Further derivation for specialized input List-selection, confirmation, text, time, numbers, IP addresses, ...
  • 65. Hands-on: Data Query Allow the user to enter his name: Andreas Jakl, 2008 65
  • 66. Data Queries Enable various ways of user input Consist of a prompt and input editor(s) Several specialized data dialog classes defined in S60, e.g.: CAknTextQueryDialog: Text input CAknNumberQueryDialog: Allows entering a number CAknTimeQueryDialog: Time/Date Andreas Jakl, 2008 66
  • 67. Defining the Data Query Andreas Jakl, 2008 67 UiTestContainer.hrh enumTUiTestContainerViewControls { ENameQueryDialogId = 1 // Define a unique id for each control in the dialog }; // ... important if you want to get a pointer to it in the source code UiTestContainer.rssi RESOURCE DIALOG r_ui_test_name_query { flags = EAknGeneralQueryFlags; buttons = R_AVKON_SOFTKEYS_OK_CANCEL; // Softkeys to be displayed items = { DLG_LINE// Defines each line of a dialog – in this case the line is more complex { // because the contained Avkon-control is made up of multiple lines itself type = EAknCtQuery; // Type of the query id = ENameQueryDialogId; // Unique ID, defined by yourself in .hrh-file control = AVKON_DATA_QUERY { layout = EDataLayout; label = STR_NameQuery; // Text of the query, is put on a predefined label-control -> define in .l01! control = EDWIN// Define the editor window control { maxlength = 20; // Maximum allowed input length default_input_mode = EAknEditorTextInputMode; // Initial text input mode }; }; } }; }
  • 68. Display the Data Query Andreas Jakl, 2008 68 UiTestContainerView.cpp // Define the descriptor that is to contain the user name TBuf<20> userName; // Create the text query dialog, giving it a reference to the descriptor that will contain the data CAknTextQueryDialog* txtDlg = CAknTextQueryDialog::NewL(userName); // You can modify the dialog from the source code. This enables the T9 input method. txtDlg->SetPredictiveTextInputPermitted(ETrue); // Execute and destroy the dialog – you don’t have to delete it yourself! if (txtDlg->ExecuteLD(R_UI_TEST_NAME_QUERY)) { // Copy the old contents of our command handling code in here, so that it’s only executed when the // user enters a name and doesn’t choose to cancel. }
  • 69. Dialog Classes (5) Andreas Jakl, 2008 69 Eikon CEikDialog Avkon CAknDialog CAknNoteDialog CAknQueryDialog CAknForm CAknForm Dual mode: viewing and editing For collection of related data Special form of a dialog
  • 70. Forms Two modes: View mode (= list box, highlight fields) Edit mode (edit fields) Default: Switch modes in options menu Multi-page Forms: Tabs to group relevant controls Andreas Jakl, 2008 70 View State Edit State Multi-page Forms
  • 71. … let’s move to the Challenges! Try it for your own Andreas Jakl, 2008 71