然后设置了焦点的变化,按向下键就切换到第2个CEikEdwin,问题就来了,当在上面的CEikEdwin用拼音输入的时候
因为字要翻页需要向下按键,结果光标直接跳到下面的CEikEdwin了,这要如何解决呢?
我在想是不是系统的输入法没有返回 EKeyWasConsumed 导致了我的组件也捕捉到了向下的这个按键事件呢?
希望各位大哥帮忙解决一下这个问题。
16 个解决方案
#1
iEditor->SetFocus(true);
#2
这个是让CEikEdwin获得光标吧? 我有这句话啊 不然按下键的时候光标也移不下去了
#3
我就是想在中文输入法选字的时候把CEikEdwin不捕获按下的键
#4
参考
Series60Ex\editor
Series60Ex\editor
#5
我是参照Series60Ex\BookStore的例子 添加一本书的时候也是这个情况 一按输入法打字下翻 光标也下去了
#6
有没有人碰到过相关问题啊,我急着解决这个问题啊,难道非要做个next的菜单键来进行下移才行
#7
贴出你的代码容易发现问题
#8
TKeyResponse CTestDemoAddContainer::OfferKeyEventL(
const TKeyEvent& aKeyEvent,
TEventCode aType )
{
if(aType == EEventKeyDown)
{
switch (aKeyEvent.iScanCode)
{
case EStdKeyUpArrow:
if(iEdwinPhone->IsFocused())
{
iEdwinPhone->SetFocus(EFalse);
iEdwinName->SetFocus(ETrue);
return EKeyWasConsumed;
}
else if(iEdwinPic->IsFocused())
{
iEdwinPic->SetFocus(EFalse);
iEdwinPhone->SetFocus(ETrue);
return EKeyWasConsumed;
}
break;
case EStdKeyDownArrow:
if(iEdwinPhone->IsFocused())
{
iEdwinPhone->SetFocus(EFalse);
iEdwinPic->SetFocus(ETrue);
return EKeyWasConsumed;
}
else if(iEdwinName->IsFocused())
{
iEdwinName->SetFocus(EFalse);
iEdwinPhone->SetFocus(ETrue);
return EKeyWasConsumed;
}
break;
}
}
if (iEdwinPhone->IsFocused())
{
return iEdwinPhone->OfferKeyEventL(aKeyEvent, aType);
}
if (iEdwinName->IsFocused())
{
return iEdwinName->OfferKeyEventL(aKeyEvent, aType);
}
if( iEdwinPic->IsFocused())
{
return iEdwinPic->OfferKeyEventL(aKeyEvent, aType);
}
return EKeyWasNotConsumed;
}
const TKeyEvent& aKeyEvent,
TEventCode aType )
{
if(aType == EEventKeyDown)
{
switch (aKeyEvent.iScanCode)
{
case EStdKeyUpArrow:
if(iEdwinPhone->IsFocused())
{
iEdwinPhone->SetFocus(EFalse);
iEdwinName->SetFocus(ETrue);
return EKeyWasConsumed;
}
else if(iEdwinPic->IsFocused())
{
iEdwinPic->SetFocus(EFalse);
iEdwinPhone->SetFocus(ETrue);
return EKeyWasConsumed;
}
break;
case EStdKeyDownArrow:
if(iEdwinPhone->IsFocused())
{
iEdwinPhone->SetFocus(EFalse);
iEdwinPic->SetFocus(ETrue);
return EKeyWasConsumed;
}
else if(iEdwinName->IsFocused())
{
iEdwinName->SetFocus(EFalse);
iEdwinPhone->SetFocus(ETrue);
return EKeyWasConsumed;
}
break;
}
}
if (iEdwinPhone->IsFocused())
{
return iEdwinPhone->OfferKeyEventL(aKeyEvent, aType);
}
if (iEdwinName->IsFocused())
{
return iEdwinName->OfferKeyEventL(aKeyEvent, aType);
}
if( iEdwinPic->IsFocused())
{
return iEdwinPic->OfferKeyEventL(aKeyEvent, aType);
}
return EKeyWasNotConsumed;
}
#9
你不止两个editor
#10
是啊 3个 这个没关系的
#11
1、editor的focuse 全部设置试下
即iEdwinPic->SetFocus(EFalse);
2、将下面的"return EKeyWasConsumed;" 屏蔽,
case EStdKeyUpArrow:
if(iEdwinPhone-> IsFocused())
{
iEdwinPhone-> SetFocus(EFalse);
iEdwinName-> SetFocus(ETrue);
// return EKeyWasConsumed;
}
else if(iEdwinPic-> IsFocused())
{
iEdwinPic-> SetFocus(EFalse);
iEdwinPhone-> SetFocus(ETrue);
// return EKeyWasConsumed;
}
break;
大概的比较了你帖出的代码不同有以上两点,可以尝试。
即iEdwinPic->SetFocus(EFalse);
2、将下面的"return EKeyWasConsumed;" 屏蔽,
case EStdKeyUpArrow:
if(iEdwinPhone-> IsFocused())
{
iEdwinPhone-> SetFocus(EFalse);
iEdwinName-> SetFocus(ETrue);
// return EKeyWasConsumed;
}
else if(iEdwinPic-> IsFocused())
{
iEdwinPic-> SetFocus(EFalse);
iEdwinPhone-> SetFocus(ETrue);
// return EKeyWasConsumed;
}
break;
大概的比较了你帖出的代码不同有以上两点,可以尝试。
#12
这帖子要顶一下,和我发的http://topic.csdn.net/u/20071030/14/2e973458-c5a5-4982-b197-ed387ddb2ca3.html?seed=1719379804异曲同工啊。。。
楼主你解决没有啊??解决了说下啊。。。
楼主你解决没有啊??解决了说下啊。。。
#13
等待牛人来答.
#14
TKeyResponse CTestDemoAddContainer::OfferKeyEventL(
const TKeyEvent& aKeyEvent,
TEventCode aType )
{
if(aType == EEventKeyDown)
{
switch (aKeyEvent. iCode)
{
case EStdKeyUpArrow:
if(iEdwinPhone->IsFocused())
{
iEdwinPhone->SetFocus(EFalse);
iEdwinName->SetFocus(ETrue);
return EKeyWas NotConsumed;
}
else if(iEdwinPic->IsFocused())
{
iEdwinPic->SetFocus(EFalse);
iEdwinPhone->SetFocus(ETrue);
return EKeyWasNotConsumed;
}
break;
case EStdKeyDownArrow:
if(iEdwinPhone->IsFocused())
{
iEdwinPhone->SetFocus(EFalse);
iEdwinPic->SetFocus(ETrue);
return EKeyWasNotConsumed;
}
else if(iEdwinName->IsFocused())
{
iEdwinName->SetFocus(EFalse);
iEdwinPhone->SetFocus(ETrue);
return EKeyWasNotConsumed;
}
break;
}
}
if (iEdwinPhone->IsFocused())
{
return iEdwinPhone->OfferKeyEventL(aKeyEvent, aType);
}
if (iEdwinName->IsFocused())
{
return iEdwinName->OfferKeyEventL(aKeyEvent, aType);
}
if( iEdwinPic->IsFocused())
{
return iEdwinPic->OfferKeyEventL(aKeyEvent, aType);
}
return EKeyWasNotConsumed;
}
const TKeyEvent& aKeyEvent,
TEventCode aType )
{
if(aType == EEventKeyDown)
{
switch (aKeyEvent. iCode)
{
case EStdKeyUpArrow:
if(iEdwinPhone->IsFocused())
{
iEdwinPhone->SetFocus(EFalse);
iEdwinName->SetFocus(ETrue);
return EKeyWas NotConsumed;
}
else if(iEdwinPic->IsFocused())
{
iEdwinPic->SetFocus(EFalse);
iEdwinPhone->SetFocus(ETrue);
return EKeyWasNotConsumed;
}
break;
case EStdKeyDownArrow:
if(iEdwinPhone->IsFocused())
{
iEdwinPhone->SetFocus(EFalse);
iEdwinPic->SetFocus(ETrue);
return EKeyWasNotConsumed;
}
else if(iEdwinName->IsFocused())
{
iEdwinName->SetFocus(EFalse);
iEdwinPhone->SetFocus(ETrue);
return EKeyWasNotConsumed;
}
break;
}
}
if (iEdwinPhone->IsFocused())
{
return iEdwinPhone->OfferKeyEventL(aKeyEvent, aType);
}
if (iEdwinName->IsFocused())
{
return iEdwinName->OfferKeyEventL(aKeyEvent, aType);
}
if( iEdwinPic->IsFocused())
{
return iEdwinPic->OfferKeyEventL(aKeyEvent, aType);
}
return EKeyWasNotConsumed;
}
#15
TKeyResponse ret = EKeyWasNotConsumed;
if (iEdwin->IsFocused())
{
ret= iEdwin->OfferKeyEventL(aKeyEvent,aType);
if (ret == EKeyWasNotConsumed)
{
switch(aKeyEvent.iCode)
{
case EKeyDownArrow:
{
iEdwin->SetFocus(EFalse);
}
break;
default:
break;
}
}
}
你这里要检查iEdwin->OfferKeyEventL(aKeyEvent,aType)的返回值,
如果该事件iEdwin处理,它返回EKeyWasConsumed,否则返回EKeyWasNotConsumed,这样就能区分是输入时翻页还是你主动按下向下键
if (iEdwin->IsFocused())
{
ret= iEdwin->OfferKeyEventL(aKeyEvent,aType);
if (ret == EKeyWasNotConsumed)
{
switch(aKeyEvent.iCode)
{
case EKeyDownArrow:
{
iEdwin->SetFocus(EFalse);
}
break;
default:
break;
}
}
}
你这里要检查iEdwin->OfferKeyEventL(aKeyEvent,aType)的返回值,
如果该事件iEdwin处理,它返回EKeyWasConsumed,否则返回EKeyWasNotConsumed,这样就能区分是输入时翻页还是你主动按下向下键
#16
没用 试过了 只要不是输入状态返回都是0
#1
iEditor->SetFocus(true);
#2
这个是让CEikEdwin获得光标吧? 我有这句话啊 不然按下键的时候光标也移不下去了
#3
我就是想在中文输入法选字的时候把CEikEdwin不捕获按下的键
#4
参考
Series60Ex\editor
Series60Ex\editor
#5
我是参照Series60Ex\BookStore的例子 添加一本书的时候也是这个情况 一按输入法打字下翻 光标也下去了
#6
有没有人碰到过相关问题啊,我急着解决这个问题啊,难道非要做个next的菜单键来进行下移才行
#7
贴出你的代码容易发现问题
#8
TKeyResponse CTestDemoAddContainer::OfferKeyEventL(
const TKeyEvent& aKeyEvent,
TEventCode aType )
{
if(aType == EEventKeyDown)
{
switch (aKeyEvent.iScanCode)
{
case EStdKeyUpArrow:
if(iEdwinPhone->IsFocused())
{
iEdwinPhone->SetFocus(EFalse);
iEdwinName->SetFocus(ETrue);
return EKeyWasConsumed;
}
else if(iEdwinPic->IsFocused())
{
iEdwinPic->SetFocus(EFalse);
iEdwinPhone->SetFocus(ETrue);
return EKeyWasConsumed;
}
break;
case EStdKeyDownArrow:
if(iEdwinPhone->IsFocused())
{
iEdwinPhone->SetFocus(EFalse);
iEdwinPic->SetFocus(ETrue);
return EKeyWasConsumed;
}
else if(iEdwinName->IsFocused())
{
iEdwinName->SetFocus(EFalse);
iEdwinPhone->SetFocus(ETrue);
return EKeyWasConsumed;
}
break;
}
}
if (iEdwinPhone->IsFocused())
{
return iEdwinPhone->OfferKeyEventL(aKeyEvent, aType);
}
if (iEdwinName->IsFocused())
{
return iEdwinName->OfferKeyEventL(aKeyEvent, aType);
}
if( iEdwinPic->IsFocused())
{
return iEdwinPic->OfferKeyEventL(aKeyEvent, aType);
}
return EKeyWasNotConsumed;
}
const TKeyEvent& aKeyEvent,
TEventCode aType )
{
if(aType == EEventKeyDown)
{
switch (aKeyEvent.iScanCode)
{
case EStdKeyUpArrow:
if(iEdwinPhone->IsFocused())
{
iEdwinPhone->SetFocus(EFalse);
iEdwinName->SetFocus(ETrue);
return EKeyWasConsumed;
}
else if(iEdwinPic->IsFocused())
{
iEdwinPic->SetFocus(EFalse);
iEdwinPhone->SetFocus(ETrue);
return EKeyWasConsumed;
}
break;
case EStdKeyDownArrow:
if(iEdwinPhone->IsFocused())
{
iEdwinPhone->SetFocus(EFalse);
iEdwinPic->SetFocus(ETrue);
return EKeyWasConsumed;
}
else if(iEdwinName->IsFocused())
{
iEdwinName->SetFocus(EFalse);
iEdwinPhone->SetFocus(ETrue);
return EKeyWasConsumed;
}
break;
}
}
if (iEdwinPhone->IsFocused())
{
return iEdwinPhone->OfferKeyEventL(aKeyEvent, aType);
}
if (iEdwinName->IsFocused())
{
return iEdwinName->OfferKeyEventL(aKeyEvent, aType);
}
if( iEdwinPic->IsFocused())
{
return iEdwinPic->OfferKeyEventL(aKeyEvent, aType);
}
return EKeyWasNotConsumed;
}
#9
你不止两个editor
#10
是啊 3个 这个没关系的
#11
1、editor的focuse 全部设置试下
即iEdwinPic->SetFocus(EFalse);
2、将下面的"return EKeyWasConsumed;" 屏蔽,
case EStdKeyUpArrow:
if(iEdwinPhone-> IsFocused())
{
iEdwinPhone-> SetFocus(EFalse);
iEdwinName-> SetFocus(ETrue);
// return EKeyWasConsumed;
}
else if(iEdwinPic-> IsFocused())
{
iEdwinPic-> SetFocus(EFalse);
iEdwinPhone-> SetFocus(ETrue);
// return EKeyWasConsumed;
}
break;
大概的比较了你帖出的代码不同有以上两点,可以尝试。
即iEdwinPic->SetFocus(EFalse);
2、将下面的"return EKeyWasConsumed;" 屏蔽,
case EStdKeyUpArrow:
if(iEdwinPhone-> IsFocused())
{
iEdwinPhone-> SetFocus(EFalse);
iEdwinName-> SetFocus(ETrue);
// return EKeyWasConsumed;
}
else if(iEdwinPic-> IsFocused())
{
iEdwinPic-> SetFocus(EFalse);
iEdwinPhone-> SetFocus(ETrue);
// return EKeyWasConsumed;
}
break;
大概的比较了你帖出的代码不同有以上两点,可以尝试。
#12
这帖子要顶一下,和我发的http://topic.csdn.net/u/20071030/14/2e973458-c5a5-4982-b197-ed387ddb2ca3.html?seed=1719379804异曲同工啊。。。
楼主你解决没有啊??解决了说下啊。。。
楼主你解决没有啊??解决了说下啊。。。
#13
等待牛人来答.
#14
TKeyResponse CTestDemoAddContainer::OfferKeyEventL(
const TKeyEvent& aKeyEvent,
TEventCode aType )
{
if(aType == EEventKeyDown)
{
switch (aKeyEvent. iCode)
{
case EStdKeyUpArrow:
if(iEdwinPhone->IsFocused())
{
iEdwinPhone->SetFocus(EFalse);
iEdwinName->SetFocus(ETrue);
return EKeyWas NotConsumed;
}
else if(iEdwinPic->IsFocused())
{
iEdwinPic->SetFocus(EFalse);
iEdwinPhone->SetFocus(ETrue);
return EKeyWasNotConsumed;
}
break;
case EStdKeyDownArrow:
if(iEdwinPhone->IsFocused())
{
iEdwinPhone->SetFocus(EFalse);
iEdwinPic->SetFocus(ETrue);
return EKeyWasNotConsumed;
}
else if(iEdwinName->IsFocused())
{
iEdwinName->SetFocus(EFalse);
iEdwinPhone->SetFocus(ETrue);
return EKeyWasNotConsumed;
}
break;
}
}
if (iEdwinPhone->IsFocused())
{
return iEdwinPhone->OfferKeyEventL(aKeyEvent, aType);
}
if (iEdwinName->IsFocused())
{
return iEdwinName->OfferKeyEventL(aKeyEvent, aType);
}
if( iEdwinPic->IsFocused())
{
return iEdwinPic->OfferKeyEventL(aKeyEvent, aType);
}
return EKeyWasNotConsumed;
}
const TKeyEvent& aKeyEvent,
TEventCode aType )
{
if(aType == EEventKeyDown)
{
switch (aKeyEvent. iCode)
{
case EStdKeyUpArrow:
if(iEdwinPhone->IsFocused())
{
iEdwinPhone->SetFocus(EFalse);
iEdwinName->SetFocus(ETrue);
return EKeyWas NotConsumed;
}
else if(iEdwinPic->IsFocused())
{
iEdwinPic->SetFocus(EFalse);
iEdwinPhone->SetFocus(ETrue);
return EKeyWasNotConsumed;
}
break;
case EStdKeyDownArrow:
if(iEdwinPhone->IsFocused())
{
iEdwinPhone->SetFocus(EFalse);
iEdwinPic->SetFocus(ETrue);
return EKeyWasNotConsumed;
}
else if(iEdwinName->IsFocused())
{
iEdwinName->SetFocus(EFalse);
iEdwinPhone->SetFocus(ETrue);
return EKeyWasNotConsumed;
}
break;
}
}
if (iEdwinPhone->IsFocused())
{
return iEdwinPhone->OfferKeyEventL(aKeyEvent, aType);
}
if (iEdwinName->IsFocused())
{
return iEdwinName->OfferKeyEventL(aKeyEvent, aType);
}
if( iEdwinPic->IsFocused())
{
return iEdwinPic->OfferKeyEventL(aKeyEvent, aType);
}
return EKeyWasNotConsumed;
}
#15
TKeyResponse ret = EKeyWasNotConsumed;
if (iEdwin->IsFocused())
{
ret= iEdwin->OfferKeyEventL(aKeyEvent,aType);
if (ret == EKeyWasNotConsumed)
{
switch(aKeyEvent.iCode)
{
case EKeyDownArrow:
{
iEdwin->SetFocus(EFalse);
}
break;
default:
break;
}
}
}
你这里要检查iEdwin->OfferKeyEventL(aKeyEvent,aType)的返回值,
如果该事件iEdwin处理,它返回EKeyWasConsumed,否则返回EKeyWasNotConsumed,这样就能区分是输入时翻页还是你主动按下向下键
if (iEdwin->IsFocused())
{
ret= iEdwin->OfferKeyEventL(aKeyEvent,aType);
if (ret == EKeyWasNotConsumed)
{
switch(aKeyEvent.iCode)
{
case EKeyDownArrow:
{
iEdwin->SetFocus(EFalse);
}
break;
default:
break;
}
}
}
你这里要检查iEdwin->OfferKeyEventL(aKeyEvent,aType)的返回值,
如果该事件iEdwin处理,它返回EKeyWasConsumed,否则返回EKeyWasNotConsumed,这样就能区分是输入时翻页还是你主动按下向下键
#16
没用 试过了 只要不是输入状态返回都是0