30 <p><note>Tactile feedback is included in those common UI components where |
30 <p><note>Tactile feedback is included in those common UI components where |
31 it has been seen as beneficial. When creating new applications and designing |
31 it has been seen as beneficial. When creating new applications and designing |
32 custom components, tactile feedback is to be included where found useful. |
32 custom components, tactile feedback is to be included where found useful. |
33 For example, in any button type of UI component, the tactile feedback is naturally |
33 For example, in any button type of UI component, the tactile feedback is naturally |
34 beneficial.</note></p> |
34 beneficial.</note></p> |
|
35 <p>In your application, you can use the following feedback types, defined |
|
36 in <codeph>TTouchLogicalFeedback</codeph>:</p> |
|
37 <table id="GUID-6FF24F72-C352-4027-AA5D-2D34EBFA00F4"> |
|
38 <tgroup cols="2"><colspec colname="col1"/><colspec colname="col2"/> |
|
39 <tbody> |
|
40 <row> |
|
41 <entry><p><codeph>ETouchFeedbackNone</codeph></p></entry> |
|
42 <entry><p>Used for disabling feedback in some areas of the application window |
|
43 while using the area registry.</p></entry> |
|
44 </row> |
|
45 <row> |
|
46 <entry><p><codeph>ETouchFeedbackBasic</codeph></p></entry> |
|
47 <entry><p>Used as a default feedback for stylus touch down events. For example, |
|
48 when the mobile device user taps a button or tab.</p></entry> |
|
49 </row> |
|
50 <row> |
|
51 <entry><p><codeph>ETouchFeedbackSensitive</codeph></p></entry> |
|
52 <entry><p>Provides sensitive feedback in situations when:<ul> |
|
53 <li><p>the triggering action is not very important (for example, change of |
|
54 focus in a list).</p></li> |
|
55 <li><p>there can be a large number of feedback instances within a short time |
|
56 (for example, text selection which gives feedback on every new selected character).</p></li> |
|
57 </ul> It is also used for scrolling and dragging.</p></entry> |
|
58 </row> |
|
59 </tbody> |
|
60 </tgroup> |
|
61 </table> |
|
62 <p>To use vibration or audio feedback in your application:</p> |
|
63 <ol> |
|
64 <li id="GUID-791E80D6-6935-4202-81E0-BA7392A9E1B3"><p>Include <codeph>touchfeedback.lib</codeph> in |
|
65 your <codeph>.mmp</codeph> file.</p></li> |
|
66 <li id="GUID-A185188F-F37B-440B-8213-214D77CF3B8B"><p>Include <parmname>touchfeedback.h</parmname>.</p></li> |
|
67 <li id="GUID-6455F4C1-AEA6-4C30-8E9B-DF9950558E17"><itemgroup><p>To enable |
|
68 tactile feedback for your application, add the following code.</p><codeblock xml:space="preserve">MTouchFeedback* feedback = MTouchFeedback::Instance(); |
|
69 feedback->SetFeedbackEnabledForThisApp(ETrue); // enabling feedback is optional </codeblock><p>Do |
|
70 not delete the pointer in the controller destructor.</p></itemgroup></li> |
|
71 <li id="GUID-FC1B810B-99F4-44E5-82DC-46686D6D4198"><itemgroup><p>To use tactile |
|
72 feedback when a mobile device user points at a control, add the following |
|
73 code.</p><codeblock xml:space="preserve">void CMyContainerControl::HandlePointerEventL(const TPointerEvent& aPointerEvent) |
|
74 { |
|
75 // Feedback is always played at pointer down event |
|
76 if(aPointerEvent.iType == TPointerEvent::EButton1Down) |
|
77 { |
|
78 MTouchFeedback* feedback = MTouchFeedback::Instance(); |
|
79 if (feedback) |
|
80 { |
|
81 feedback->InstantFeedback(ETouchFeedbackBasic); |
|
82 } |
|
83 } |
|
84 |
|
85 // Your other pointer event handling code here |
|
86 </codeblock></itemgroup></li> |
|
87 <li id="GUID-A26D8717-1839-4132-98C4-5C09086BB361"><itemgroup><p>To enable |
|
88 automatic feedback triggering in a specific area of a UI component, add</p><codeblock xml:space="preserve">feedback->SetFeedbackArea( this, |
|
89 1, // area Id |
|
90 TRect( 0,0,20,20 ), |
|
91 ETouchFeedbackBasic, |
|
92 ETouchEventStylusDown ); |
|
93 </codeblock></itemgroup></li> |
|
94 </ol> |
|
95 <note><ul> |
|
96 <li><p>To use tactile feedback in an application, additional platform security |
|
97 capabilities are not required.</p></li> |
|
98 <li><p>Applications themselves do not need to generate feedback effects, unless |
|
99 they are using custom components. The feedback is generated by components |
|
100 that the applications use.</p></li> |
|
101 </ul></note> |
35 <p>For more information, see <xref href="GUID-581A8E4B-12BE-41C0-A20E-3087A80FEECF.dita">Tactile |
102 <p>For more information, see <xref href="GUID-581A8E4B-12BE-41C0-A20E-3087A80FEECF.dita">Tactile |
36 feedback</xref>.</p> |
103 feedback</xref>.</p> |
37 </conbody></concept> |
104 </conbody></concept> |