📄 index.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"><title>Editor Example</title><link href="style.css" rel="stylesheet" type="text/css"></head><table border="0" width="100%" height="8" bgcolor="#eeeeee"><tr> <td width="100%" height="1"><b><font size="2" color="#000000" face="Arial, Helvetica, sans-serif"><strong><a name=Top></a>S60 3rd Edition SDK FP1 for Symbian OS </strong></font></b><br><i>Example Applications Guide</i></td></tr> </table><!-- Generated by Doxygen 1.4.5 --><div class="tabs"> <ul> <li id="current"><a href="index.html"><span>Main Page</span></a></li> <li><a href="annotated.html"><span>Classes</span></a></li> <li><a href="files.html"><span>Files</span></a></li> </ul></div><h1>Editor Example</h1><p><a class="el" href="index.html#Intro_sec">1. About this Example</a> <br><a class="el" href="index.html#UI_sec">2. User Interface</a> <br><a class="el" href="index.html#Implementation_sec">3. Implementation</a><p><hr><h2><a class="anchor" name="Intro_sec">1. About this Example</a></h2>This tutorial explains how to use the editor window in Avkon applications. The example application consists of a multiline text editor.<p>In the editor example application, the following features are provided.<p><ul><li>Clearing the text</li><li>Changing the font</li><li>Using clipboard (copying, cutting and pasting)</li><li>Saving the text in a file and opening the file</li></ul><h3><a class="anchor" name="Sub11">1.1 APIs demonstrated</a></h3>The key classes of the Editor example are CEikEdwin and CEikGlobalTextEditor.<p><hr><h2><a class="anchor" name="UI_sec">2. User Interface</a></h2>This section shows how the editor window is displayed to users and explains how to use its features with the Editor example application.<p>The features are accessed from the <b>Options</b> menu. To display the <b>Options</b> menu, press the left soft key in initial view.<p>The main screen of the Editor example is below.<p><div align="center"><img src="image_editor01.gif" alt="image_editor01.gif"></div><h3><a class="anchor" name="Sub21">2.1 Clearing text</a></h3>To clear the text, select <b>Clear text</b> in the <b>Options</b> menu.<h3><a class="anchor" name="Sub22">2.2 Scrolling text</a></h3>To scroll the text, select <b>Scroll text</b> in the <b>Options</b> menu and choose <b>Scroll up</b> or <b>Scroll down</b>.<p><div align="center"><img src="image_editor02.gif" alt="image_editor02.gif"></div><h3><a class="anchor" name="Sub23">2.3 Changing font</a></h3>To change the font of the text, select <b>Set font</b> in the <b>Options</b> menu and choose the new font.<p><div align="center"><img src="image_editor03.gif" alt="image_editor03.gif"></div><h3><a class="anchor" name="Sub24">2.4 Cliboard operations</a></h3>To perform clipboard operations such as selecting text, copying and pasting, select <b>Clipboard</b> in the <b>Options</b> menu and choose the appropriate command.<p><div align="center"><img src="image_editor04.gif" alt="image_editor04.gif"></div><h3><a class="anchor" name="Sub25">2.5 File operations</a></h3>To save the text to a file or to open a file, select <b>File</b> in the <b>Options</b> menu and choose <b>Save text to a file</b> or <b>Open a file</b>. A text file must be saved, before it can be opened.<p><div align="center"><img src="image_editor05.gif" alt="image_editor05.gif"></div><h2><a class="anchor" name="Implementation_sec">3. Implementation</a></h2><h3><a class="anchor" name="Sub31">3.1 Resources</a></h3>The example application defines the editing window by using the following resource definition:<p><div class="fragment"><pre class="fragment"> RESOURCE GTXTED r_aknexeditor_view_gtexted { flags = EAknEditorFlagDefault; avkon_flags = EAknEditorFlagEnableScrollBars; width = qnn_aknexeditor_view_gtexted_width; height = qnn_aknexeditor_view_gtexted_height; numlines = qnn_aknexeditor_view_gtexted_numlines; textlimit= qnn_aknexeditor_view_gtexted_textlimit; fontcontrolflags = EGulFontControlAll; fontnameflags = EGulNoSymbolFonts; }</pre></div><p>The Avkon flag EAknEditorFlagEnableScrollBars enables the vertical scrollbar.<h3><a class="anchor" name="Sub32">3.2 Constructing the editor window</a></h3>To construct an editor from a resouce, the first-phase constructor must be called. After that, the editor can be constructed by using ConstructFromResourceL function. Because the container does not perform any drawing, SetBlank function is called. This is done in <a class="el" href="class_c_akn_ex_editor_container.html#bf31593b337cbf3fb671382cf773281c">CAknExEditorContainer::ConstructL</a>.<h3><a class="anchor" name="Sub33">3.3 Implementation of other features</a></h3>Clipboard functions are implemented by calling function CEikEdwin::EnableCcpuSupportL( ETrue ) in the ConstructL function. After that, the cut, copy and paste functions are accessible. The scrolling feature is done by using MoveCursorL function. Saving to a file uses CPlainText::ExportAsTextL and opening a file uses CEikEdwin::InsertFromTextFileL.<p>The example application handles resolution change while the application is running. This is achieved by implementing function <a class="el" href="class_c_akn_ex_editor_app_ui.html#6acdbe8a9b57446075bf46d035e751eb">HandleResourceChangeL </a> in application UI class. In case the resolution changes, it calls function <a class="el" href="class_c_akn_ex_editor_view.html#abc08dd887c2d766c9e11fe20187ac05">HandleViewRectChange </a> in the view class. Finally, the view calls container's SetRect function, which results in a call to container's <a class="el" href="class_c_akn_ex_editor_container.html#9f9bb5a2110532e2f2909eaefb44d36a">CAknExEditorContainer::SizeChanged</a> function, in which the logic is implemented. <hr><table x-use-null-cells style="x-cell-content-align: top; width: 100%; border-spacing: 0px; border-spacing: 0px;" cellspacing=0 width=100%> <col style="width: 50%;"> <col style="width: 50%;"> <tr style="x-cell-content-align: top;" valign=top> <td style="width: 50%; padding-right: 10px; padding-left: 10px; border-right-style: None; border-left-style: None; border-top-style: None; border-bottom-style: None;" width=50%> <p style="font-family: Arial;"><small style="font-size: smaller;">
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -