两侧同时换到之前的修订记录 前一修订版 | |||
5.控件详解:0.系统键盘 [2021/02/01 10:01] tjcqiu |
5.控件详解:0.系统键盘 [2021/02/01 10:03] (当前版本) tjcqiu |
||
---|---|---|---|
行 1: | 行 1: | ||
- | <h1 style="white-space: normal; text-align: center;">系统键盘使用说明</h1><hr/><p style="white-space: normal;"><br/></p><table><tbody><tr class="firstRow"><td width="166" valign="middle" align="center" style="word-break: break-all;">名称</td><td width="166" valign="middle" align="center" style="word-break: break-all;">操作</td><td width="90" valign="middle" align="center" style="word-break: break-all;">版本</td><td width="133" valign="middle" align="center" style="word-break: break-all;">日期<br/></td><td valign="middle" colspan="1" rowspan="1" width="275" align="center" style="word-break: break-all;">说明</td><td valign="middle" colspan="1" rowspan="1" align="center" width="166" style="word-break: break-all;">编辑</td></tr><tr><td width="166" valign="middle" align="center" style="word-break: break-all;">《系统键盘使用说明》</td><td width="166" valign="middle" align="center" style="word-break: break-all;">创建中</td><td width="90" valign="middle" align="center" style="word-break: break-all;">V1.0</td><td width="133" valign="middle" align="center" style="word-break: break-all;">2020-12-17</td><td valign="middle" colspan="1" rowspan="1" width="275" align="center" style="word-break: break-all;">第一次编辑完成,正式发布。</td><td valign="middle" colspan="1" rowspan="1" align="center" width="166" style="word-break: break-all;">qjj</td></tr><tr><td valign="middle" colspan="1" rowspan="1" align="center" style="word-break: break-all;">《系统键盘使用说明》</td><td valign="middle" colspan="1" rowspan="1" align="center" style="word-break: break-all;">修订</td><td valign="middle" colspan="1" rowspan="1" align="center" style="word-break: break-all;">V1.1</td><td valign="middle" colspan="1" rowspan="1" align="center" style="word-break: break-all;">2020-12-21</td><td valign="middle" colspan="1" rowspan="1" align="center" style="word-break: break-all;"><span style="color: rgb(0, 0, 0);">补充系统键盘中所有使用详解</span></td><td valign="middle" colspan="1" rowspan="1" align="center" style="word-break: break-all;">qjj</td></tr></tbody></table><p style="white-space: normal;"><br/></p><hr/><p style="white-space: normal; line-height: 1.75em;"><strong>【目录】<br/></strong></p><p style="white-space: normal; line-height: 1.75em;"><strong>一、<a href="#yi" target="_self">系统键盘-概述</a></strong></p><p style="white-space: normal; line-height: 1.75em;"><strong>二、<a href="#er" target="_self">系统键盘-使用说明</a></strong></p><p style="white-space: normal; line-height: 1.75em;"><strong>三、<a href="#san" target="_self">系统键盘使用过程中常见问题</a></strong></p><hr/><p><a name="yi"></a><strong>一、系统键盘-概述</strong></p><p style="text-indent: 2em;">1.1、系统键盘是默认存放工程内,不调用不会占用工程内存。</p><p style="text-indent: 2em;">1.2、控件调用系统键盘,点击控件将会弹出系统键盘。</p><p style="text-indent: 2em;"><br/></p><hr/><p style="text-indent: 0em;"><a name="er"></a>二<strong style="white-space: normal;">、系统键盘-使用说明</strong></p><p style="text-indent: 2em;"><strong><span style="font-size: 18px;">2.1、控件调用系统键盘</span></strong><strong style="white-space: normal;"><br/></strong></p><p style="text-indent: 2em;"><span style="color: rgb(255, 0, 0);"><strong style="white-space: normal;"><span style="font-family: Arial, sans-serif; font-size: 14px; background-color: rgb(255, 255, 255);">将控件vscope属性设置为全局,key属性选择相应的键盘。</span></strong></span></p><p style="text-indent: 2em;"><img src="/dokuwiki/ueditor/php/upload/image/20201217/1608191482115914.png" title="1608191482115914.png" alt="image.png"/></p><p style="text-indent: 2em;">调用键盘后默认导入相关字库资源文件</p><p style="text-indent: 2em;"><img src="/dokuwiki/ueditor/php/upload/image/20201217/1608191732800434.png" title="1608191732800434.png" alt="image.png"/></p><p style="text-indent: 2em;"><br/></p><p style="text-indent: 2em;">在页面窗口最下面页面生成相应键盘界面,默认键盘是上锁的,如果对键盘界面修改或者键盘里面功能进行修改,可以点击页面键盘右键解锁它并做相关的修改。<span style="color: rgb(255, 0, 0);">如果不小心对键盘做了不必要的修改,可以右键重置键盘,键盘将会恢复默认键盘最初始的设置状态</span>。</p><p style="text-indent: 2em;"><img src="/dokuwiki/ueditor/php/upload/image/20201217/1608192259120321.png" title="1608192259120321.png" alt="image.png"/></p><p style="text-indent: 0em;"><strong style="white-space: normal;"><br/></strong></p><p style="text-indent: 2em;"><strong><span style="font-size: 18px;">2.2、支持系统键盘的控件</span></strong><strong style="white-space: normal;"><br/></strong></p><p style="text-indent: 2em;"><span style="font-size: 14px;"><strong>文本控件、数字控件、虚拟浮点数控件、滚动文本控件、滑动文本控件。</strong></span></p><p style="text-indent: 2em;"><span style="font-size: 14px;"><strong><br/></strong></span></p><p style="text-indent: 2em;"><strong><span style="font-size: 18px;">2.3、常见系统键盘修改使用</span></strong></p><p style="text-indent: 2em;"><a name="ersanyi"></a><a href="#ersanyi" target="_self"><span style="text-indent: 2em; color: rgb(0, 0, 0);"><strong>2.3.1、进入系统键盘将输入框清空</strong></span></a></p><p style="text-indent: 2em;"><span style="font-family: arial, helvetica, sans-serif; text-indent: 2em;">在系统键盘页面的后初始化事件配置input.txt=""</span></p><p><br/></p><p style="text-indent: 2em;"><span style="font-family: arial, helvetica, sans-serif; text-indent: 2em;"></span><a name="ersaner"></a><a href="#ersaner" target="_self"><span style="color: rgb(0, 0, 0); text-decoration: underline;"><strong>2.3.2、在系统键盘设置好参数</strong></span></a><span style="color: rgb(0, 0, 0); text-decoration: underline;"><strong>通过串口发送出去</strong></span><br/></p><p style="text-indent: 2em;"><span style="font-family: arial, helvetica, sans-serif; text-indent: 2em;">1.解锁键盘页面<br/></span></p><p style="text-indent: 2em;"><br/></p><p style="text-indent: 2em;"><img src="/dokuwiki/ueditor/php/upload/image/20201225/1608879571793807.jpeg" title="1608879571793807.jpeg" alt="wpsB747.tmp.jpeg"/></p><p style="text-indent: 2em;">2.编辑ok按钮的弹起事件,在page指令前加上prints input.txt,0语句。<br/></p><p style="text-indent: 2em;"><img src="/dokuwiki/ueditor/php/upload/image/20201225/1608879589105569.png" title="1608879589105569.png" alt="QQ图片20201225145855.png"/></p><p style="text-indent: 2em;">注:<span style="color: rgb(255, 0, 0);">page指令之后的指令是不会被执行的,因为已经跳转到别的页面了。</span></p><p style="text-indent: 2em;"><br/></p><p style="text-indent: 2em;"><br/></p><p style="text-indent: 2em;"><a name="ersansan"></a><strong>2.3.3、</strong><a href="#ersansan" target="_self"><strong style="color: rgb(0, 0, 0); text-decoration: underline;"><span style="color: rgb(0, 0, 0);">不同控件在系统键盘设置好参数存储到用户存储区</span></strong></a></p><p style="text-indent: 2em;">1.设置一个全局变量,在需要系统键盘存储到用户存储区的控件按下事件对全局变量赋值(不同的控件赋值不一样)。</p><p style="text-indent: 2em;"><img src="/dokuwiki/ueditor/php/upload/image/20201218/1608269411783565.png" title="1608269411783565.png" alt="image.png"/></p><p style="text-indent: 2em;"><br/></p><p style="text-indent: 2em;">2.在系统键盘页面,编辑ok按钮的弹起事件。</p><p style="text-indent: 2em;">①存储变量类型为val</p><p style="text-indent: 2em;"><img src="/dokuwiki/ueditor/php/upload/image/20201218/1608272052841271.png" title="1608272052841271.png" alt="image.png"/></p><p style="text-indent: 2em;"><span style="text-indent: 32px;">注:</span><span style="text-indent: 32px; color: rgb(255, 0, 0);">page指令之后的指令是不会被执行的,因为已经跳转到别的页面</span><span style="color: rgb(255, 0, 0); text-indent: 32px;">了。</span></p><p style="text-indent: 2em;"><br/></p><p style="text-indent: 2em;">②存储变量类型为txt</p><p style="text-indent: 2em;"><img src="/dokuwiki/ueditor/php/upload/image/20201218/1608272407959866.png" title="1608272407959866.png" alt="image.png"/></p><p style="text-indent: 2em;"><span style="text-indent: 32px;">注:</span><span style="color: rgb(255, 0, 0); text-indent: 32px;">page指令之后的指令是不会被执行的,因为已经跳转到别的页面了。</span></p><p style="text-indent: 2em;"><span style="color: rgb(255, 0, 0);">   默认show文本控件txt_maxl设置为32,会占比较大eeprom存储空间。</span></p><p style="text-indent: 2em;"><br/></p><p style="white-space: normal; text-indent: 2em;"><strong><a name="ersansi"></a></strong><a href="#ersansi" target="_self"><span style="text-decoration: none;"><strong>2.3.4、自定义键盘</strong></span></a></p><p style="white-space: normal; text-indent: 2em;"><span style="font-family: arial, helvetica, sans-serif;">基于官方的键盘进行更改</span></p><p style="white-space: normal; text-indent: 2em;"><span style="font-family: arial, helvetica, sans-serif; text-indent: 2em;">page到键盘页之前,先对键盘页的loadgageid.val和loadcmpid.vid赋值就可以了(一般是文本控件或数字控件和弹起或按下事件中进行赋值,页面名.loadpageid.val=dp,页面名.loadcmpid.val=当前控件的id),其他的逻辑会自动实现,loadpageid.val表示调用页的页面ID,loadcmpid.val表示调用页的控件ID。</span></p><p style="text-indent: 0em; white-space: normal;"><span style="font-family: arial, helvetica, sans-serif; text-indent: 2em;">       <span style="color: rgb(255, 0, 0); font-size: 14px;">注:正常情况下控件设置</span><span style="color: rgb(255, 0, 0); font-size: 14px; font-family: Arial, sans-serif; background-color: rgb(255, 255, 255);">将控件vscope属性设置为全局,key属性选择相应的键盘就好。</span></span></p><p style="text-indent: 2em;"><strong><span style="font-size: 18px;"><br/></span></strong></p><p style="text-indent: 2em;"><strong><span style="font-size: 18px;">2.4、系统键盘页面常用控件和变量说明</span></strong></p><p style="text-indent: 2em;">①变量<span style="font-family: arial, helvetica, sans-serif; text-indent: 32px;">loadpageid.val表示调用页的页面ID。</span></p><p style="text-indent: 2em;"><span style="font-family: arial, helvetica, sans-serif; text-indent: 32px;">②变量loadcmpid.val表示调用页的控件ID。</span></p><p style="text-indent: 2em;"><span style="font-family: arial, helvetica, sans-serif; text-indent: 32px;">③定时器tm0是让输入框有个光标不断闪烁,如果不需要,控件属性en=0即可。</span></p><p style="text-indent: 2em;"><span style="font-family:arial, helvetica, sans-serif">④变量inputlenth获取正在使用系统键盘控件字符最大长度。</span></p><p style="text-indent: 2em;"><span style="font-family:arial, helvetica, sans-serif">⑤变量input表示输入的数据。</span></p><p style="text-indent: 2em;"><span style="font-family:arial, helvetica, sans-serif">⑥变量show表示键盘显示的数据。</span></p><p style="text-indent: 2em;"><span style="font-family:arial, helvetica, sans-serif">⑦按钮b249是让键盘输入框变成*显示。</span></p><hr/><p style="text-align: left; text-indent: 0em;"><a name="san"></a>三<strong style="white-space: normal;">、系统键盘使用过程中常见问题</strong></p><p style="text-indent: 2em;"><strong>1.系统键盘无法用输入法打出汉字</strong><br/></p><p style="text-indent: 2em;">可能原因1:工程设备字符编码设置为utf-8,utf-8不支持输入法打出汉字</p><p style="text-indent: 2em;">解决办法:将工程设备字符编码设置非为utf-8字符编码。</p><p style="text-indent: 2em;">可能原因2:输入法键盘没有切换成输入法<br/></p><p style="text-indent: 2em;">解决办法:将系统键盘切换成中文输入法,此时下方的按钮显示为"英"。</p><p style="text-indent: 2em;">可能原因3:输入的字符无法拼音构成汉字,例:"www"</p><p style="text-indent: 2em;">解决办法:输入的字符为拼音可构成汉字。例:"wen","ni"。</p><p style="text-indent: 2em;"><strong>2.系统键盘无法输入字符</strong><br/></p><p style="text-indent: 2em;">可能原因:在调用键盘前读取了eeprom中的数据,eeprom并没有初始化,里面存储随机值中有非法字符导致输入框被填满且无法显示。<br/></p><p style="text-indent: 2em;">解决办法:<span style="text-indent: 2em;">第一次开机通过代码对eeprom进行一次初始化</span></p><pre class="brush:cpp;toolbar:false" style="margin-top: 5px; margin-bottom: 5px; padding: 0.7em 1em; font-family: Consolas, "Andale Mono WT", "Andale Mono", "Bitstream Vera Sans Mono", "Nimbus Mono L", Monaco, "Courier New", monospace; font-size: 14px; direction: ltr; background-color: rgb(251, 250, 249); color: rgb(51, 51, 51); box-shadow: rgb(204, 204, 204) 0px 0px 0.5em inset; border-radius: 2px; overflow: auto; overflow-wrap: normal; border: 1px solid rgb(204, 204, 204);"><span style="font-size: 16px;">for(sys0=0;sys0<1021;sys0++)<br/>{<br/>  wepo 0,sys0<br/>}</span></pre><p style="text-indent: 2em;"><strong>3.控件调用系统键盘输入值后,控件又回到默认值</strong></p><p style="text-indent: 2em;">可能原因:数据输入时是通过切换页面调用系统键盘,当输入完数据会再次回到控件的页面,此时会再次执行页面初始化事件,初始化事件的赋值会对控件重新赋值,这样就会好像控件回到默认值(复位)一样,导致调用系统键盘给控件赋值无效。</p><p style="text-indent: 2em;">解决办法:</p><p style="text-indent: 2em;">①不要在此控件页面初始化事件里给控件赋初始值,可以专门做一个用来上电赋初始值的页面,做为上电默认页,在此页面的初始化事件里完成所有的初始化动作之后,再切换到工程主页,这样初始化动作就只会上电执行一次,不会重复执行。</p><p style="text-indent: 2em;">②在数据输入页面建一个变量(设置全局),用来表示是否已经初始化过了,赋初始值的时候判断控件是否已经被初始化过,是的话就不要再赋初值了,这样键盘调用完之后再次回来就不会重复执行了。<br/></p><p style="text-indent: 2em;"><br/></p> | + | <h1 style="white-space: normal; text-align: center;">系统键盘使用说明</h1><hr/><p style="white-space: normal;"><br/></p><table><tbody><tr class="firstRow"><td width="166" valign="middle" align="center" style="word-break: break-all;">名称</td><td width="166" valign="middle" align="center" style="word-break: break-all;">操作</td><td width="90" valign="middle" align="center" style="word-break: break-all;">版本</td><td width="133" valign="middle" align="center" style="word-break: break-all;">日期<br/></td><td valign="middle" colspan="1" rowspan="1" width="275" align="center" style="word-break: break-all;">说明</td><td valign="middle" colspan="1" rowspan="1" align="center" width="166" style="word-break: break-all;">编辑</td></tr><tr><td width="166" valign="middle" align="center" style="word-break: break-all;">《系统键盘使用说明》</td><td width="166" valign="middle" align="center" style="word-break: break-all;">创建中</td><td width="90" valign="middle" align="center" style="word-break: break-all;">V1.0</td><td width="133" valign="middle" align="center" style="word-break: break-all;">2020-12-17</td><td valign="middle" colspan="1" rowspan="1" width="275" align="center" style="word-break: break-all;">第一次编辑完成,正式发布。</td><td valign="middle" colspan="1" rowspan="1" align="center" width="166" style="word-break: break-all;">qjj</td></tr><tr><td valign="middle" colspan="1" rowspan="1" align="center" style="word-break: break-all;">《系统键盘使用说明》</td><td valign="middle" colspan="1" rowspan="1" align="center" style="word-break: break-all;">修订</td><td valign="middle" colspan="1" rowspan="1" align="center" style="word-break: break-all;">V1.1</td><td valign="middle" colspan="1" rowspan="1" align="center" style="word-break: break-all;">2020-12-21</td><td valign="middle" colspan="1" rowspan="1" align="center" style="word-break: break-all;"><span style="color: rgb(0, 0, 0);">补充系统键盘中所有使用详解</span></td><td valign="middle" colspan="1" rowspan="1" align="center" style="word-break: break-all;">qjj</td></tr></tbody></table><p style="white-space: normal;"><br/></p><hr/><p style="white-space: normal; line-height: 1.75em;"><strong>【目录】<br/></strong></p><p style="white-space: normal; line-height: 1.75em;"><strong>一、<a href="#yi" target="_self">系统键盘-概述</a></strong></p><p style="white-space: normal; line-height: 1.75em;"><strong>二、<a href="#er" target="_self">系统键盘-使用说明</a></strong></p><p style="white-space: normal; line-height: 1.75em;"><strong>三、<a href="#san" target="_self">系统键盘使用过程中常见问题</a></strong></p><hr/><p><a name="yi"></a><strong>一、系统键盘-概述</strong></p><p style="text-indent: 2em;">1.1、系统键盘是默认存放工程内,不调用不会占用工程内存。</p><p style="text-indent: 2em;">1.2、控件调用系统键盘,点击控件将会弹出系统键盘。</p><p style="text-indent: 2em;"><br/></p><hr/><p style="text-indent: 0em;"><a name="er"></a>二<strong style="white-space: normal;">、系统键盘-使用说明</strong></p><p style="text-indent: 2em;"><strong><span style="font-size: 18px;">2.1、控件调用系统键盘</span></strong><strong style="white-space: normal;"><br/></strong></p><p style="text-indent: 2em;"><span style="color: rgb(255, 0, 0);"><strong style="white-space: normal;"><span style="font-family: Arial, sans-serif; font-size: 14px; background-color: rgb(255, 255, 255);">将控件vscope属性设置为全局,key属性选择相应的键盘。</span></strong></span></p><p style="text-indent: 2em;"><img src="/dokuwiki/ueditor/php/upload/image/20201217/1608191482115914.png" title="1608191482115914.png" alt="image.png"/></p><p style="text-indent: 2em;">调用键盘后默认导入相关字库资源文件</p><p style="text-indent: 2em;"><img src="/dokuwiki/ueditor/php/upload/image/20201217/1608191732800434.png" title="1608191732800434.png" alt="image.png"/></p><p style="text-indent: 2em;"><br/></p><p style="text-indent: 2em;">在页面窗口最下面页面生成相应键盘界面,默认键盘是上锁的,如果对键盘界面修改或者键盘里面功能进行修改,可以点击页面键盘右键解锁它并做相关的修改。<span style="color: rgb(255, 0, 0);">如果不小心对键盘做了不必要的修改,可以右键重置键盘,键盘将会恢复默认键盘最初始的设置状态</span>。</p><p style="text-indent: 2em;"><img src="/dokuwiki/ueditor/php/upload/image/20201217/1608192259120321.png" title="1608192259120321.png" alt="image.png"/></p><p style="text-indent: 0em;"><strong style="white-space: normal;"><br/></strong></p><p style="text-indent: 2em;"><strong><span style="font-size: 18px;">2.2、支持系统键盘的控件</span></strong><strong style="white-space: normal;"><br/></strong></p><p style="text-indent: 2em;"><span style="font-size: 14px;"><strong>文本控件、数字控件、虚拟浮点数控件、滚动文本控件、滑动文本控件。</strong></span></p><p style="text-indent: 2em;"><span style="font-size: 14px;"><strong><br/></strong></span></p><p style="text-indent: 2em;"><strong><span style="font-size: 18px;">2.3、常见系统键盘修改使用</span></strong></p><p style="text-indent: 2em;"><a name="ersanyi"></a><a href="#ersanyi" target="_self"><span style="text-indent: 2em; color: rgb(0, 0, 0);"><strong>2.3.1、进入系统键盘将输入框清空</strong></span></a></p><p style="text-indent: 2em;"><span style="font-family: arial, helvetica, sans-serif; text-indent: 2em;">在系统键盘页面的后初始化事件配置input.txt=""</span></p><p><br/></p><p style="text-indent: 2em;"><span style="font-family: arial, helvetica, sans-serif; text-indent: 2em;"></span><a name="ersaner"></a><a href="#ersaner" target="_self"><span style="color: rgb(0, 0, 0); text-decoration: underline;"><strong>2.3.2、在系统键盘设置好参数</strong></span></a><span style="color: rgb(0, 0, 0); text-decoration: underline;"><strong>通过串口发送出去</strong></span><br/></p><p style="text-indent: 2em;"><span style="font-family: arial, helvetica, sans-serif; text-indent: 2em;">1.解锁键盘页面<br/></span></p><p style="text-indent: 2em;"><br/></p><p style="text-indent: 2em;"><img src="/dokuwiki/ueditor/php/upload/image/20201225/1608879571793807.jpeg" title="1608879571793807.jpeg" alt="wpsB747.tmp.jpeg"/></p><p style="text-indent: 2em;">2.编辑ok按钮的弹起事件,在page指令前加上prints input.txt,0语句。<br/></p><p style="text-indent: 2em;"><img src="/dokuwiki/ueditor/php/upload/image/20201225/1608879589105569.png" title="1608879589105569.png" alt="QQ图片20201225145855.png"/></p><p style="text-indent: 2em;">注:<span style="color: rgb(255, 0, 0);">page指令之后的指令是不会被执行的,因为已经跳转到别的页面了。</span></p><p style="text-indent: 2em;"><br/></p><p style="text-indent: 2em;"><br/></p><p style="text-indent: 2em;"><a name="ersansan"></a><strong>2.3.3、</strong><a href="#ersansan" target="_self"><strong style="color: rgb(0, 0, 0); text-decoration: underline;"><span style="color: rgb(0, 0, 0);">不同控件在系统键盘设置好参数存储到用户存储区</span></strong></a></p><p style="text-indent: 2em;">1.设置一个全局变量,在需要系统键盘存储到用户存储区的控件按下事件对全局变量赋值(不同的控件赋值不一样)。</p><p style="text-indent: 2em;"><img src="/dokuwiki/ueditor/php/upload/image/20201218/1608269411783565.png" title="1608269411783565.png" alt="image.png"/></p><p style="text-indent: 2em;"><br/></p><p style="text-indent: 2em;">2.在系统键盘页面,编辑ok按钮的弹起事件。</p><p style="text-indent: 2em;">①存储变量类型为val</p><p style="text-indent: 2em;"><img src="/dokuwiki/ueditor/php/upload/image/20201218/1608272052841271.png" title="1608272052841271.png" alt="image.png"/></p><p style="text-indent: 2em;"><span style="text-indent: 32px;">注:</span><span style="text-indent: 32px; color: rgb(255, 0, 0);">page指令之后的指令是不会被执行的,因为已经跳转到别的页面</span><span style="color: rgb(255, 0, 0); text-indent: 32px;">了。</span></p><p style="text-indent: 2em;"><br/></p><p style="text-indent: 2em;">②存储变量类型为txt</p><p style="text-indent: 2em;"><img src="/dokuwiki/ueditor/php/upload/image/20201218/1608272407959866.png" title="1608272407959866.png" alt="image.png"/></p><p style="text-indent: 2em;"><span style="text-indent: 32px;">注:</span><span style="color: rgb(255, 0, 0); text-indent: 32px;">page指令之后的指令是不会被执行的,因为已经跳转到别的页面了。</span></p><p style="text-indent: 2em;"><span style="color: rgb(255, 0, 0);">   默认show文本控件txt_maxl设置为32,会占比较大eeprom存储空间。</span></p><p style="text-indent: 2em;"><br/></p><p style="white-space: normal; text-indent: 2em;"><strong><a name="ersansi"></a></strong><a href="#ersansi" target="_self" style="text-decoration: underline; color: rgb(0, 0, 0);"><span style="text-decoration: none; color: rgb(0, 0, 0);"><strong>2.3.4、自定义键盘</strong></span></a></p><p style="white-space: normal; text-indent: 2em;"><span style="font-family: arial, helvetica, sans-serif;">基于官方的键盘进行更改</span></p><p style="white-space: normal; text-indent: 2em;"><span style="font-family: arial, helvetica, sans-serif; text-indent: 2em;">page到键盘页之前,先对键盘页的loadgageid.val和loadcmpid.vid赋值就可以了(一般是文本控件或数字控件和弹起或按下事件中进行赋值,页面名.loadpageid.val=dp,页面名.loadcmpid.val=当前控件的id),其他的逻辑会自动实现,loadpageid.val表示调用页的页面ID,loadcmpid.val表示调用页的控件ID。</span></p><p style="text-indent: 0em; white-space: normal;"><span style="font-family: arial, helvetica, sans-serif; text-indent: 2em;">       <span style="color: rgb(255, 0, 0); font-size: 14px;">注:正常情况下控件设置</span><span style="color: rgb(255, 0, 0); font-size: 14px; font-family: Arial, sans-serif; background-color: rgb(255, 255, 255);">将控件vscope属性设置为全局,key属性选择相应的键盘就好。</span></span></p><p style="text-indent: 2em;"><strong><span style="font-size: 18px;"><br/></span></strong></p><p style="text-indent: 2em;"><strong><span style="font-size: 18px;">2.4、系统键盘页面常用控件和变量说明</span></strong></p><p style="text-indent: 2em;">①变量<span style="font-family: arial, helvetica, sans-serif; text-indent: 32px;">loadpageid.val表示调用页的页面ID。</span></p><p style="text-indent: 2em;"><span style="font-family: arial, helvetica, sans-serif; text-indent: 32px;">②变量loadcmpid.val表示调用页的控件ID。</span></p><p style="text-indent: 2em;"><span style="font-family: arial, helvetica, sans-serif; text-indent: 32px;">③定时器tm0是让输入框有个光标不断闪烁,如果不需要,控件属性en=0即可。</span></p><p style="text-indent: 2em;"><span style="font-family:arial, helvetica, sans-serif">④变量inputlenth获取正在使用系统键盘控件字符最大长度。</span></p><p style="text-indent: 2em;"><span style="font-family:arial, helvetica, sans-serif">⑤变量input表示输入的数据。</span></p><p style="text-indent: 2em;"><span style="font-family:arial, helvetica, sans-serif">⑥变量show表示键盘显示的数据。</span></p><p style="text-indent: 2em;"><span style="font-family:arial, helvetica, sans-serif">⑦按钮b249是让键盘输入框变成*显示。</span></p><hr/><p style="text-align: left; text-indent: 0em;"><a name="san"></a>三<strong style="white-space: normal;">、系统键盘使用过程中常见问题</strong></p><p style="text-indent: 2em;"><strong>1.系统键盘无法用输入法打出汉字</strong><br/></p><p style="text-indent: 2em;">可能原因1:工程设备字符编码设置为utf-8,utf-8不支持输入法打出汉字</p><p style="text-indent: 2em;">解决办法:将工程设备字符编码设置非为utf-8字符编码。</p><p style="text-indent: 2em;">可能原因2:输入法键盘没有切换成输入法<br/></p><p style="text-indent: 2em;">解决办法:将系统键盘切换成中文输入法,此时下方的按钮显示为"英"。</p><p style="text-indent: 2em;">可能原因3:输入的字符无法拼音构成汉字,例:"www"</p><p style="text-indent: 2em;">解决办法:输入的字符为拼音可构成汉字。例:"wen","ni"。</p><p style="text-indent: 2em;"><strong>2.系统键盘无法输入字符</strong><br/></p><p style="text-indent: 2em;">可能原因:在调用键盘前读取了eeprom中的数据,eeprom并没有初始化,里面存储随机值中有非法字符导致输入框被填满且无法显示。<br/></p><p style="text-indent: 2em;">解决办法:<span style="text-indent: 2em;">第一次开机通过代码对eeprom进行一次初始化</span></p><pre class="brush:cpp;toolbar:false" style="margin-top: 5px; margin-bottom: 5px; padding: 0.7em 1em; font-family: Consolas, "Andale Mono WT", "Andale Mono", "Bitstream Vera Sans Mono", "Nimbus Mono L", Monaco, "Courier New", monospace; font-size: 14px; direction: ltr; background-color: rgb(251, 250, 249); color: rgb(51, 51, 51); box-shadow: rgb(204, 204, 204) 0px 0px 0.5em inset; border-radius: 2px; overflow: auto; overflow-wrap: normal; border: 1px solid rgb(204, 204, 204);"><span style="font-size: 16px;">for(sys0=0;sys0<1021;sys0++)<br/>{<br/>  wepo 0,sys0<br/>}</span></pre><p style="text-indent: 2em;"><strong>3.控件调用系统键盘输入值后,控件又回到默认值</strong></p><p style="text-indent: 2em;">可能原因:数据输入时是通过切换页面调用系统键盘,当输入完数据会再次回到控件的页面,此时会再次执行页面初始化事件,初始化事件的赋值会对控件重新赋值,这样就会好像控件回到默认值(复位)一样,导致调用系统键盘给控件赋值无效。</p><p style="text-indent: 2em;">解决办法:</p><p style="text-indent: 2em;">①不要在此控件页面初始化事件里给控件赋初始值,可以专门做一个用来上电赋初始值的页面,做为上电默认页,在此页面的初始化事件里完成所有的初始化动作之后,再切换到工程主页,这样初始化动作就只会上电执行一次,不会重复执行。</p><p style="text-indent: 2em;">②在数据输入页面建一个变量(设置全局),用来表示是否已经初始化过了,赋初始值的时候判断控件是否已经被初始化过,是的话就不要再赋初值了,这样键盘调用完之后再次回来就不会重复执行了。<br/></p><p style="text-indent: 2em;"><br/></p> |