📄 symbian 编程札记(转) - 本立道生,道以为用 -- it博客-中国最具人气的it博客-赛迪网it人家园.mht
字号:
BaflUtils,=20
=CA=C7RFs=D3=D0=D3=C3=B5=C4=B9=A4=BE=DF=BC=AF=A3=AC =
=C8=E7=C5=D0=B6=CFfile=A1=A2directory=CA=C7=B7=F1=B4=E6=D4=DA=A3=AC=BD=AB=
=C2=B7=BE=B6=C3=FB=B7=D6=B8=EE=B3=C9=C4=BF=C2=BC=C3=FB=A1=A2=CE=C4=BC=FE=C3=
=FB=A1=A2=C5=CC=B7=FB=B5=C8=A1=A3<BR><BR><BR>28,=20
System changes and network changes<BR>1) RChangeNotifier is system =
change=20
notifier, you will be notified the is system status changes, such =
as power=20
supply, memory, time etc. all types of changes are defined in=20
TChanges.<BR><BR>2) Network changes notifier is implemented as=20
RConnection::AllInterfaceNotifier. When the connection goes up or =
down,=20
that type of notifier wil be obtained. When the notifier is =
obtained, you=20
can use RConnection::EnumerateConnections to get the number of =
current=20
connections, if the number is 0, we can get the connection goes =
down;=20
otherwise, the connection goes up.<BR><BR><BR>29, Handle key event =
in=20
view<BR>Events framework of symbian are:<BR><BR>Window server send =
key or=20
pointer events or some other special events to Symbian =
application, it=20
calls one of a number of functions, according to the type of =
event. The=20
application handles key event by calling=20
CAknAppUi::HandleWsEventL,<BR><BR>For key events,=20
CAknAppUi::HandleWsEventL calls CCoeControl::OfferKeyEventL() for =
each=20
control on the control stack, beginning with the control at the =
top=20
(position 0) until a control consumes it. If no control on the =
stack=20
consumes the key event, the app UI's HandleKeyEventL() is called. =
Note=20
that CCoeControl::OfferKeyEventL() is not called for controls =
whose=20
ECoeStackFlagRefusesAllKeys flag is set.<BR><BR><BR>1) Override =
member=20
functions HandleKeyEventL and InputCapabilities in =
CAknAppUi/CAknViewAppUi=20
derived class1 <BR>TCoeInputCapabilities =
CMyAppUi::InputCapabilities()=20
const<BR>{<BR>return (TCoeInputCapabilities::EAllText |=20
TCoeInputCapabilities::ENavigation);<BR>}<BR><BR>TKeyResponse=20
CMyAppUi::HandleKeyEventL(const TKeyEvent& =
aKeyEvent,TEventCode aType)=20
{<BR>TInt retVal =3D EKeyWasNotConsumed;<BR>if (iView) //iViews is =
member of=20
CAknView<BR>{<BR>CMyiew *pView =3D static_cast<CMyView=20
*>(iView)<BR>retVal =3D pView->HandleKeyEventL(aKeyEvent, =
aType); //=20
HandleKeyEventL is member function of CMyiew which is derived from =
CAknView, but it is not member of CAknView<BR>}<BR><BR>return=20
retVal;<BR>}<BR><BR><BR>2) Handle key event in view<BR>class =
CMyView :=20
public CAknView<BR>{<BR><BR>..........<BR><BR>TKeyResponse=20
HandleKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType)=20
<BR>{<BR>TInt retVal =3D EKeyWasNotConsumed;<BR><BR>if (aType !=3D =
EKeyEventDown)<BR>{<BR>return=20
=
retVal<BR>}<BR><BR>switch(aKeyEvent.iCode)<BR>{<BR>case:<BR>.............=
.<BR>}<BR><BR>return=20
retVal;<BR>}<BR>};<BR><BR></P></TD></TR></TBODY></TABLE>
<DIV class=3Dbb>
<DIV>=C0=E0=B1=F0=A3=BA <A=20
href=3D"http://careerman.blog.ccidnet.com/blog-htm-do-list-uid-12026-type=
-blog-dirid-0.html">=CE=DE=B7=D6=C0=E0</A>=20
| <A=20
href=3D"http://careerman.blog.ccidnet.com/blog-htm-do-showone-uid-12026-t=
ype-blog-itemid-821784.html#c">=C6=C0=C2=DB</A>(<SPAN=20
id=3Dsum>1</SPAN>) | <A=20
href=3D"http://careerman.blog.ccidnet.com/blog-htm-do-showone-uid-12026-t=
ype-blog-itemid-821784.html">=E4=AF=C0=C0</A>(1789)=20
| <A title=3D=BC=D3=C8=EB=CA=E9=C7=A9 style=3D"CURSOR: pointer"=20
onclick=3D"addtoclt(821784,'blog');">=CA=D5=B2=D8</A></DIV>
<DIV class=3Dc></DIV></DIV><!--begin comment--><A name=3Dmao></A>
<DIV class=3D"comment bb">
<H5 id=3Dcdisplay style=3D"DISPLAY: none">=D2=BB=B9=B2=D3=D0 <SPAN =
id=3Dsums>1</SPAN> =CC=F5=C6=C0=C2=DB</H5><SPAN=20
id=3Dajaxreply><A name=3Dc0></A>
<SCRIPT>=0A=
var commentIds =3D new Array();=0A=
</SCRIPT>
</SPAN><INPUT id=3Dcommentid type=3Dhidden name=3Dcommentid>=20
<DIV class=3Dbig id=3Dcommentspage></DIV>
<FORM name=3DFORM>
<DIV class=3Dpost-comment>
<H5>=B7=A2=B1=ED=C6=C0=C2=DB</H5>
<DIV><A>=D3=C3=BB=A7=C3=FB=A3=BA</A><INPUT class=3Dip id=3Dguestname =
tabIndex=3D1 size=3D22 name=3Dguestname>=20
</DIV>
<DIV><TEXTAREA class=3Dip id=3Dcontent onkeydown=3Dquickpost(event) =
style=3D"WIDTH: 95%" tabIndex=3D4 name=3Dcontent rows=3D10></TEXTAREA>=20
</DIV>
<DIV><IMG id=3Dck style=3D"CURSOR: pointer"=20
onclick=3D"javascript:newgdcode(ck,'ck.php?windid=3Dguest');" =
alt=3D=BF=B4=B2=BB=C7=E5=B3=FE=A3=AC=BB=BB=D2=BB=D5=C5=20
src=3D"http://careerman.blog.ccidnet.com/ck.php?windid=3Dguest" =
align=3DabsMiddle>=20
<INPUT class=3Dip id=3Dgdcode tabIndex=3D1 size=3D4 name=3Dgdcode> =
<INPUT id=3Difcode=20
type=3Dhidden value=3Dguest> <INPUT class=3Dbt id=3Dcsubmit =
onclick=3Dpostcomment(); tabIndex=3D5 type=3Dbutton value=3D"=CC=E1 =
=BD=BB" name=3DSubmit valign=3D"middle">=20
</DIV></DIV></FORM>
<SCRIPT language=3DJavaScript>=0A=
var now =3D new Date();=0A=
var ny =3D now.getYear();=0A=
var nm =3D parseInt(now.getMonth())+1;=0A=
nm =3D nm.toString();=0A=
nm =3D LenthByByte(nm) < 2 ? '0' + nm : nm;=0A=
var nd =3D now.getDate();=0A=
var actdo =3D 'showone';=0A=
var nextid =3D '1';=0A=
var nexturl =3D '#';=0A=
var nextdate =3D ny + '=C4=EA' + nm + '=D4=C2' + nd + '=C8=D5';=0A=
var nexticon =3D 'image/upload/none.gif';=0A=
var allow =3D '0';=0A=
var type =3D 'blog';=0A=
</SCRIPT>
<DIV class=3Dc></DIV></DIV><!--begin =
comment--></DIV><!--end--></DIV></DIV><!--end main--><BR=20
class=3Dc></DIV><!--<script language=3D"JavaScript" =
src=3D"http://image.ccidnet.com/ad_files/home_daohang/copyright_1128.js">=
</script>--></DIV></DIV></DIV>
<SCRIPT language=3Djavascript=20
src=3D"http://www.ccidnet.com/images/image_service/blank_blog.js"></SCRIP=
T>
<!-- ccidnet -->
<SCRIPT language=3DJavaScript type=3Dtext/javascript>=0A=
var _PCSWebSite=3D"100001";=0A=
var _PCSImage=3D"countlogo1.gif";=0A=
</SCRIPT>
<SCRIPT language=3DJavaScript =
src=3D"http://stat.ccidnet.com/count/count.js"=20
type=3Dtext/javascript></SCRIPT>
<!-- ccidnet --></BODY></HTML>
------=_NextPart_001_0009_01CBA6C8.BC0E12A0
Content-Type: text/html;
charset="gb2312"
Content-Transfer-Encoding: 7bit
Content-Location: http://image.ccidnet.com/nav/aleax_counts.htm
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=gb2312">
<META content="MSHTML 6.00.6000.16640" name=GENERATOR></HEAD>
<BODY></BODY></HTML>
------=_NextPart_001_0009_01CBA6C8.BC0E12A0--
------=_NextPart_000_0000_01CBA6C8.BC0BC8B0
Content-Type: application/x-js
Content-Transfer-Encoding: quoted-printable
Content-Location: http://blog.ccidnet.com/js/global.js
var cookie_name =3D 0;
var agt =3D navigator.userAgent.toLowerCase();
var is_ie =3D ((agt.indexOf("msie") !=3D -1) && (agt.indexOf("opera") =
=3D=3D -1));
var is_gecko=3D (navigator.product =3D=3D "Gecko");
var cnt =3D 0;
function quickpost(event){
if ((event.ctrlKey && window.event.keyCode =3D=3D 13) || (event.altKey =
&& window.event.keyCode =3D=3D 83)) {
cnt++;
if (cnt=3D=3D1) {
postmsg();
} else {
alert('Submission Processing. Please Wait');
}
}
}
function newgdcode(obj,url) {
obj.src =3D url;
}
function GE(id) {
if (document.getElementById && document.getElementById(id)) {
return document.getElementById(id);
} else if (document.all && document.all[id]) {
return document.all[id];
} else if (document.layers && document.layers[id]) {
return document.layers[id];
} else {
return null;
}
}
function findPosX(obj){
var curleft =3D 0;
if (obj.offsetParent){
while (obj.offsetParent){
curleft +=3D obj.offsetLeft
obj =3D obj.offsetParent;
}
}
else if (obj.x)
curleft +=3D obj.x;
return curleft - ietruebody().scrollLeft;
}
function findPosY(obj){
var curtop =3D 0;
if (obj.offsetParent){
while (obj.offsetParent){
curtop +=3D obj.offsetTop
obj =3D obj.offsetParent;
}
}else if (obj.y){
curtop +=3D obj.y;
}
return curtop - ietruebody().scrollTop;;
}
function click_open(idName,object,type){
if(GE("showmenu").style.display=3D=3D''){
closep();
return false;
}
cookie_name =3D 1;
mouseover_open(idName,object,type);
}
function mouseover_open(idName,object,type){
if(typeof type =3D=3D "undefined"){
type =3D 1;
}
if(cookie_name =3D=3D 1 || type>2){
obj =3D GE("showmenu");
obj2 =3D GE(idName);
obj3 =3D GE(object);
var left =3D findPosX(obj3) + ietruebody().scrollLeft;
var top =3D findPosY(obj3) + ietruebody().scrollTop;
=09
obj.innerHTML =3D obj2.innerHTML;
obj.className =3D obj2.className;
obj.style.filter =3D "alpha(opacity=3D96);opacity:0.96;";
obj.style.display =3D "";
=09
var height =3D obj.offsetHeight;
var width =3D obj.offsetWidth;
=09
if(left + width > ietruebody().scrollLeft + ietruebody().clientWidth){
left -=3D width;
}
if(type=3D=3D'2' && height + top > ietruebody().scrollTop + =
ietruebody().clientHeight){
top -=3D height;
} else{
top +=3D type=3D=3D'4' ? 31 : 15;
}
obj.style.top =3D top + 'px';
obj.style.left =3D left + 'px';
if(type>'2'){
addEvent(document,"mouseout",doc_mouseout);
} else if(type<'2'){
addEvent(document,"mousedown",doc_mousedown);
}
}
return false;
}
function LenthByByte(str){ =20
var len;
var i;
len =3D 0;
for (i=3D0;i<str.length;i++) {
if (str.charCodeAt(i)>255) {
len+=3D2;
} else {
len++;
}
}
return len;
}
function closep(type){
if(typeof type =3D=3D "undefined"){
type =3D 'down';
}
cookie_name =3D 0;
obj =3D GE("showmenu");
obj.innerHTML =3D "";
obj.className =3D "";
obj.style.display =3D "none";
if(type=3D=3D'out'){
removeEvent(document,"mouseout",doc_mouseout);
} else{
removeEvent(document,"mousedown",doc_mousedown);
}
return false;
}
function doc_mousedown(e){
var e =3D is_ie ? event: e;
obj =3D GE("showmenu");
_x =3D is_ie ? e.x : e.pageX;
_y =3D is_ie ? e.y + ietruebody().scrollTop : e.pageY;
_x1 =3D obj.offsetLeft;
_x2 =3D obj.offsetLeft + obj.offsetWidth;
_y1 =3D obj.offsetTop - 25;
_y2 =3D obj.offsetTop + obj.offsetHeight;
if(_x<_x1 || _x>_x2 || _y<_y1 || _y>_y2){
closep('down');
}
}
function doc_mouseout(e){
var e =3D is_ie ? event: e;
obj =3D GE("showmenu");
_x =3D is_ie ? e.x : e.pageX;
_y =3D is_ie ? e.y + ietruebody().scrollTop : e.pageY;
_x1 =3D obj.offsetLeft - 20;
_x2 =3D obj.offsetLeft + obj.offsetWidth + 20;
_y1 =3D obj.offsetTop - 35;
_y2 =3D obj.offsetTop + obj.offsetHeight + 20;
if(_x<_x1 || _x>_x2 || _y<_y1 || _y>_y2){
closep('out');
}
}
function ietruebody(){
return (document.compatMode && document.compatMode!=3D"BackCompat")? =
document.documentElement : document.body;
}
function IsElement(id){
return GE(id)!=3Dnull ? true : false;
}
function quickpost(event){
if((event.ctrlKey && event.keyCode =3D=3D 13) || (event.altKey && =
event.keyCode =3D=3D 83)){
document.FORM.Submit.click();
}
}
String.prototype.trim =3D
function trim(){
return this.replace(/(^\s*)|(\s*$)/g,'');
}
function showcatemenu() {
if (GE('headmenu').style.height=3D=3D'' || =
GE('headmenu').style.height=3D=3D'15px') {
GE('headmenu').style.height =3D 'auto';
} else {
GE('headmenu
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -