Programming mobile devices - PowerPoint PPT Presentation

1 / 36
About This Presentation
Title:

Programming mobile devices

Description:

Derive a class from CCoeControl. Implement ConstructL() Override Draw() Override SizeChanged ... form for example in a dialog: RESOURCE DIALOG my_dialog. flags ... – PowerPoint PPT presentation

Number of Views:76
Avg rating:3.0/5.0
Slides: 37
Provided by: TKT2
Category:
Tags: devices | draw | flag | how | mobile | programming | to

less

Transcript and Presenter's Notes

Title: Programming mobile devices


1
Programming mobile devices
  • Part VIII
  • Programming Symbian devices with Symbian C

Graphical components
2
Content
  • Controls
  • Dialogs
  • Event handlers

3
S60 Screen
  • Status pane
  • Top of the screen
  • Title, system status
  • Main pane
  • Most of the screen (where your application
    executes)
  • Control pane
  • Screen bottom
  • Softkey buttons (like OK Cancel)

4
Controls
  • Inherit from CCoeControl
  • coecntrl.h
  • User input/output
  • nested
  • simple or compound
  • window-owning of not

5
Creating your own controls
  • Derive a class from CCoeControl
  • Implement ConstructL()
  • Override Draw()
  • Override SizeChanged()

6
Creating your own controls
  • In case of compound controls also
  • add your components to the control
  • override CountComponentControls()
  • and ComponentControl()

7
CountComponentControls
  • Used for drawing the components
  • Draw()
  • ComponentControl()
  • For simple controls, CountComponentControls
    returns 0 and ComponentControl returns NULL

8
Dialogs
  • Usually Modal, the app cannot be resumed before
    the dialog is dismissed
  • Resource file (dialog with controls and their
    captions)
  • Implementation (derive from CAknDialog)
  • ExcecuteLD

9
The resource definition
  • RESOURCE DIALOG r_dialog_play_listtitle
    "Play list"flagsEEikDialogFlagWaititems
    DLG_LINE type EEikCtListBox id
    ECtlListboxPlayList

10
The resource definition
  • control LISTBOX flags
    EEikListBoxCreateOwnWindow , DLG_LINE
    typeEEikCtDialogToolBar prompt" "
    idECtlCmdButPanel itemflagsEEikDlgItemOfferAl
    lHotKeys controlDLG_TOOLBAR
  • ...

11
The resource definition
  • DIALOG in eikon.rh
  • buttons
  • flags
  • items

12
Example
  • RESOURCE DIALOG markos_dialog
  • buttonsR_AVKON_BUTTONS_CANCEL_OK
  • flagsEGeneralQueryFlags
  • items

13
Example (cont.)
  • DLG_LINE
  • type EEikCtLabel
  • idEMarkosDialogLabel
  • control LABEL
  • txt "Tell me your secret"
  • ,

14
Example (cont.)
  • DLG_LINE
  • type EEikCtEdwin
  • idEMarkosDialogText
  • control EDWIN
  • width 25 maxlength100
  • ,

15
Buttons
  • LLINK
  • DLB_BUTTONS resource for your custom button
    selection
  • predefined sets in avkon.rsg
  • R_AVKON_DONE_CANCEL
  • R_AVKON_YES_NO
  • R_AVKON_OK_BACK
  • R_AVKON_SOFTKEYS_OK_EMPTY
  • ...

16
Flags
  • LONG value
  • Vary depending on the platform
  • Different properties of the dialog
  • For example
  • EEikDialogFlagNoDrag
  • EEikDialogFlagCbaButtons
  • EEikDialogFlagWait

17
Items
  • Array of DLG_LINE structures
  • DLG_LINE
  • type
  • id
  • control
  • Control
  • STRUCT
  • e.g. EDWIN

18
EDWIN
  • An edit window
  • LONG flags 0
  • WORD width 0
  • WORD lines 1
  • WORD maxlength 0

19
Multipage dialogs
  • You can define multipage dialogs using the pages
    field of the DIALOG resource
  • pages is an ARRAY of PAGE resources
  • for example
  • RESOURCE DIALOG my_dialog
  • ...
  • pages my_pages
  • ...

20
Multipage dialogs
  • RESOURCE ARRAY my_pages
  • items
  • PAGE
  • ...
  • ,
  • PAGE

21
PAGE
  • PAGE
  • text"Page 1"
  • linespage1lines
  • ,

22
LINES
  • RESOURCE ARRAY page1lines
  • items
  • DLG_LINE
  • type EEikCtLabel
  • idEMarkosDialogLabel
  • ...

23
FORMS
  • RESOURCE FORM
  • You can define a form for example in a dialog
  • RESOURCE DIALOG my_dialog
  • flags...
  • form my_form
  • buttons...

24
Flags
  • EEikDialogFlagWait
  • EEikDialogFlagNoTitleBar
  • EEikDialogFlagFillAppClientRect
  • EEikDialogFlagCbaButtons
  • EEikDialogFlagNoDrag

25
FORMS
  • RESOURCE FORM my_form
  • flagsEEikFormEditModeOnly
  • items
  • DLG_LINE
  • type...

26
Flags
  • EEikFormEditModeOnly
  • EEikFormHideEmptyFields
  • EEikFormShowBitmaps
  • EEikFormUseDoubleSpaceFormat

27
FORMS
  • To use the form, it is necessary to create a
    class
  • derive from CAknForm
  • override a set of methods

28
Notes
  • Confimation note
  • Wait note
  • Information note
  • Error note
  • Warning note

29
Note classes
  • CAknConfirmationNote
  • CAknInformationNote
  • CAknWarningNote
  • CAknErrorNote
  • CAknWaitDialog
  • CAknWaitNoteWrapper
  • CAknProgressDialog

30
Note classes
  • CAknGlobalNote
  • CAknNoteDialog

31
Queries
  • Confirmation query Yes/No
  • Data query, expects input
  • List query User selects one or more items

32
Lists
  • Vertical lists
  • Grids
  • One item focused at a time
  • joystick used for navigation
  • Selection key for selecting an item

33
Vertical lists
  • Selection
  • Menu
  • Markable
  • Multiselection

34
Grids
  • Selection
  • Markable
  • Multiselection
  • Menu

35
Settings lists
  • AVKON_SETTING_ITEM in the resource
  • Slider
  • Volume
  • Text editor
  • Enumerated text
  • Time or Date
  • IP address
  • Binary switch
  • Password

36
Editors
  • Text
  • Numeric
  • Secret
  • Multi-field numeric
Write a Comment
User Comments (0)
About PowerShow.com