|
1 <?xml version="1.0" encoding="utf-8"?> |
|
2 <!-- Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies) All rights reserved. --> |
|
3 <!-- This component and the accompanying materials are made available under the terms of the License |
|
4 "Eclipse Public License v1.0" which accompanies this distribution, |
|
5 and is available at the URL "http://www.eclipse.org/legal/epl-v10.html". --> |
|
6 <!-- Initial Contributors: |
|
7 Nokia Corporation - initial contribution. |
|
8 Contributors: |
|
9 --> |
|
10 <!DOCTYPE task |
|
11 PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd"> |
|
12 <task id="GUID-AC8439C7-7E57-4829-AB4B-70BC394DD66F" xml:lang="en"><title>Hiding |
|
13 item-specific commands in menus</title><shortdesc>The item-specific commands and item-action commands in options |
|
14 menu must be flagged with the <codeph>EEikMenuItemSpecific</codeph> and <codeph>EEikMenuItemAction</codeph> flags |
|
15 introduced in Symbian^3. This enables the UI framework to hide them in the |
|
16 options menu and display them only in the stylus pop-up menu. The touch down |
|
17 and hold action opens the stylus pop-up menu. Touch down and release performs |
|
18 an action.</shortdesc><prolog><metadata><keywords/></metadata></prolog><taskbody> |
|
19 <context id="GUID-29AA14A9-B1E0-4C9A-A5BB-446351A11C87"><p>Actions like opening |
|
20 a radio button list and virtual input are performed on the first tap. These |
|
21 actions are normally handled by the UI framework. However, if your application |
|
22 contains an implementation of its own for handling these actions (for example, |
|
23 opening a custom component on the second tap) it must be changed to follow |
|
24 the single-tap style.</p> </context> |
|
25 <steps-unordered id="GUID-4DD07DEC-6017-4237-BE46-1D69E5FBD744-GENID-1-4-1-1-7-1-4-1-4-1-3-2"> |
|
26 <step id="GUID-9A69E5AD-E938-4092-A8C2-CB65C37C8962-GENID-1-4-1-1-7-1-4-1-4-1-3-2-1"><cmd>Add the <codeph>EEikMenuItemAction</codeph> flag |
|
27 to all item-action commands in your options menu resource definitions. Menu |
|
28 item-action commands are functions that are called during touch down and release |
|
29 on an item (for example, <b>Open</b> action).</cmd> |
|
30 <stepxmp><p>For example, </p><codeblock xml:space="preserve">/** |
|
31 *AppList View menuitems (Counters) |
|
32 */ |
|
33 RESOURCE MENU_PANE r_logs_applist_menu |
|
34 { |
|
35 items = |
|
36 { |
|
37 MENU_ITEM |
|
38 { |
|
39 command = ELogsCmdMenuOpen; |
|
40 txt = qtn_logs_cmd_open; |
|
41 //--------------------------------------------------------------- |
|
42 // Include the following line to the list-item action commands |
|
43 <b> flags =EEikMenuItemAction; |
|
44 </b> |
|
45 //---------------------------------------------------------------- |
|
46 } |
|
47 }; |
|
48 }</codeblock></stepxmp> |
|
49 </step> |
|
50 <step id="GUID-192D8B8E-4521-40F0-81F1-7970D2487AF5"><cmd>Add the <codeph>EEikMenuItemSpecific</codeph> flag |
|
51 to all (other than item-action) item-specific commands in options menu resource |
|
52 definitions.</cmd> |
|
53 <stepxmp><p>For example, </p><codeblock xml:space="preserve">RESOURCE MENU_PANE r_common_event_menu_send_events |
|
54 { |
|
55 items = |
|
56 { |
|
57 MENU_ITEM /* Send */ |
|
58 { |
|
59 command = ELogsCmdMenuSendUi; |
|
60 txt = qtn_stm_om_send; |
|
61 //------------------------------------------------------------------------- |
|
62 //Add the following line to the list item-specific commands |
|
63 <b> flags = EEikMenuItemSpecific; |
|
64 </b>//------------------------------------------------------------------------- |
|
65 |
|
66 }, |
|
67 MENU_ITEM /* Clear list */ |
|
68 { command = ELogsCmdMenuDeleteAll; |
|
69 txt = qtn_stm_om_delete_all; } |
|
70 }; |
|
71 }</codeblock></stepxmp> |
|
72 <info><note> An application view containing <xref href="GUID-1AA32C40-CDE0-4627-A634-7C07BB1ED67B.dita">forms</xref> need |
|
73 not flag item-specific commands, as forms are always highlighted.</note></info> |
|
74 </step> |
|
75 <step id="GUID-D8010D5A-5703-4AC6-AC05-819689785680"><cmd>If your application |
|
76 code dynamically adds or removes menu items, you must change |
|
77 the flag value of the menu pane using the <xref href="GUID-F6168582-DFF1-31DF-87F9-FF2AEC5EE0FF.dita#GUID-F6168582-DFF1-31DF-87F9-FF2AEC5EE0FF/GUID-DC63590B-B1CE-3B80-BDFE-6827A381F3AD"><apiname>CEikMenuPane::SetItemSpecific()</apiname></xref> function.</cmd> |
|
78 <stepxmp><p>For example, </p><codeblock xml:space="preserve">/* Add send message item to menu above position pos */ |
|
79 TInt pos = 0; |
|
80 |
|
81 /* Returns pointer to menu item */ |
|
82 aMenuPane->ItemAndPos(ELogsCmdMenuSendUi, pos); |
|
83 |
|
84 /* Delete marker item from menu */ |
|
85 aMenuPane->DeleteMenuItem(ELogsCmdMenuSendUi); |
|
86 |
|
87 /* No need here yet to tailor subitems in SendUi menu */ |
|
88 TSendingCapabilities capabilities(0, 0, 0); |
|
89 LogsAppUi() |
|
90 -> |
|
91 SendUiL() |
|
92 ->AddSendMenuItemL |
|
93 ( |
|
94 *aMenuPane, pos, /* Position in menupane */ ELogsCmdMenuSendUi, /* Command id to be used for "Send" menu item */ |
|
95 capabilities |
|
96 ); |
|
97 aMenuPane->SetItemTextL(ELogsCmdMenuSendUi, iSendUiText->Des()); |
|
98 //------------------------------------------------------------- |
|
99 // Include the following line to dynamically change the flag value |
|
100 <b> |
|
101 aMenuPane->SetItemSpecific(ELogsCmdMenuSendUi, ETrue); |
|
102 </b>//-----------------------------------------------------------------</codeblock></stepxmp> |
|
103 </step> |
|
104 </steps-unordered> |
|
105 </taskbody></task> |