Symbian界面编程中关于Edit焦点切换的问题
来源:互联网 发布:教皇的权力 知乎 编辑:程序博客网 时间:2024/05/16 02:18
注意几点:
1. 需要自己绘制
2.
void CNugrujxtContainer::ConstructL(const TRect& aRect)
{
CreateWindowL();
iEdwin = new (ELeave) CEikEdwin();
iEdwin->SetContainerWindowL( *this );
iEdwin->ConstructL();
iEdwin->SetFocus(ETrue);
iEdwin->SetMaxLength(20);
iEdwin2 = new (ELeave) CEikEdwin();
iEdwin2->SetContainerWindowL( *this );
iEdwin2->ConstructL();
// iEdwin2->SetFocus(ETrue);
iEdwin2->SetMaxLength(20);
SetRect(aRect);
ActivateL();
}
// Destructor
CNugrujxtContainer::~CNugrujxtContainer()
{
delete iEdwin;
delete iEdwin2;
}
// ---------------------------------------------------------
// CNugrujxtContainer::SizeChanged()
// Called by framework when the view size is changed
// ---------------------------------------------------------
//
void CNugrujxtContainer::SizeChanged()
{
// TODO: Add here control resize code etc.
iEdwin->SetExtent(TPoint(2,2), TSize(100, 20));
iEdwin2->SetExtent(TPoint(2,25), TSize(100, 20));
}
// ---------------------------------------------------------
// CNugrujxtContainer::CountComponentControls() const
// ---------------------------------------------------------
//
TInt CNugrujxtContainer::CountComponentControls() const
{
return 2; // return nbr of controls inside this container
}
// ---------------------------------------------------------
// CNugrujxtContainer::ComponentControl(TInt aIndex) const
// ---------------------------------------------------------
//
CCoeControl* CNugrujxtContainer::ComponentControl(TInt aIndex) const
{
switch ( aIndex )
{
case 0:
return iEdwin;
case 1:
return iEdwin2;
default:
return NULL;
}
}
// ---------------------------------------------------------
// CNugrujxtContainer::Draw(const TRect& aRect) const
// ---------------------------------------------------------
//
void CNugrujxtContainer::Draw(const TRect& aRect) const
{
CWindowGc& gc = SystemGc();
gc.SetPenStyle( CGraphicsContext::ENullPen );
gc.SetBrushColor( KRgbWhite );
gc.SetBrushStyle( CGraphicsContext::ESolidBrush );
gc.DrawRect( aRect );
gc.SetPenStyle( CGraphicsContext::ESolidPen);
gc.SetPenColor(KRgbBlack);
// gc.SetBrushStyle( CGraphicsContext::ENullBrush );
TRect rect(iEdwin->Rect());
rect.Shrink(-1,-1);
gc.DrawRect(rect);
TRect rect2(iEdwin2->Rect());
rect2.Shrink(-1,-1);
gc.DrawRect(rect2);
}
// ----------------------------------------------------
// CNugrujxtContainer::OfferKeyEventL(
// const TKeyEvent& aKeyEvent,TEventCode /*aType*/)
// takes care of key event handling
// ----------------------------------------------------
//
TKeyResponse CNugrujxtContainer::OfferKeyEventL(
const TKeyEvent& aKeyEvent,TEventCode aType)
{
if((aKeyEvent.iCode==EKeyUpArrow)||(aKeyEvent.iCode==EKeyDownArrow))
{
if(aType==EEventKey)
{
if(iEdwin->IsFocused())
{
iEdwin->SetFocus(EFalse);
iEdwin2->SetFocus(ETrue);
DrawDeferred();
}
else
{
iEdwin2->SetFocus(EFalse);
iEdwin->SetFocus(ETrue);
DrawDeferred();
}
return EKeyWasConsumed;
}
}
else
{
if(iEdwin->IsFocused())
{
return iEdwin->OfferKeyEventL(aKeyEvent, aType);
}
if(iEdwin2->IsFocused())
{
return iEdwin2->OfferKeyEventL(aKeyEvent, aType);
}
}
return EKeyWasNotConsumed;
}
// End of File
- Symbian界面编程中关于Edit焦点切换的问题
- 关于JAVA中GUI界面切换的问题
- Symbian中关于ListBox的编程使用
- edit 焦点问题
- 关于最下方 EditText 获取焦点 界面上移的问题
- 关于对话框OnInitDialog里设置edit控件输入焦点问题
- [iOS]关于iOS中界面视图横屏/竖屏切换的问题总结
- symbian应用程序中视图切换问题[转]
- symbian应用程序中视图切换问题
- Symbian一些关于界面的资料
- 关于IOS UINavigationBar 界面切换颜色变换的问题
- scrollview 中嵌套 edittext edit无法获取焦点的解决办法
- 关于在symbian listbox中添加svg图片的问题
- 关于在symbian listbox中添加svg图片的问题
- 关于 activity 中 button 获取焦点的问题
- 关于listview中item无法获去焦点的问题
- 关于FreeTextBox的焦点问题
- 回车切换焦点问题
- oracle 存储过程
- JSON是什么-javascript eval解析json字符串为对象
- 解决asp.net中“从客户端(......)中检测到有潜在危险的 Request.Form 值。”错误
- C语言一些常用语句
- C/C++ Build Errors
- Symbian界面编程中关于Edit焦点切换的问题
- NetBeans6.8下建立Ruby调试环境
- Qt通过dom方式修改xml
- o3d教程4 - 纹理映射
- Java多线程编程要点 (一)
- 网站链接和待总结
- linux 启用root及更改密码
- winhddif blog
- Javascript判断滚动条是否到达页面的尾部