📄 myupform.cpp
字号:
/*
============================================================================
Name : MyUpForm.cpp
Author : bianbian
Version :
Copyright : Troy
Description : CMyUpForm implementation
============================================================================
*/
#include "MyUpForm.h"
#include "MyAddresses.h"
void CMyUpForm::ConstructL(const TRect& aRect)
{
iFormRect = aRect;
// Definitions
const TSize KLabelSize = TSize(150, 20);
const TPoint KOutputPosition = TPoint(10, 35);
const TSize KOutputSize = TSize(200, 20);
CreateWindowL();
_LIT(KLabelText, "收件人: ");
iLabel = new ( ELeave ) CEikLabel;
iLabel->SetContainerWindowL( *this ); //设置附着的容器
iLabel->SetTextL( KLabelText );
TPoint position(aRect.iTl.iX + 13, aRect.iTl.iY + 8);
iLabel->SetExtent( position, KLabelSize );
iEdwin = new (ELeave) CMyAddresses;
iEdwin->SetContainerWindowL( *this );
iEdwin->ConstructL(EEikEdwinNoAutoSelection);
position.iX += 40;
iEdwin->SetExtent( position, KOutputSize );
//iEdwin->SetFocus(ETrue);
//SetRect(aRect);
ActivateL();
}
CMyUpForm::~CMyUpForm()
{
delete iLabel;
delete iEdwin;
}
TKeyResponse CMyUpForm::OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType)
{
return iEdwin->OfferKeyEventL(aKeyEvent, aType);
}
// ---------------------------------------------------------
// CMyUpForm::SizeChanged()
// Called by framework when the view size is changed
// ---------------------------------------------------------
//
void CMyUpForm::SizeChanged()
{
//iEdwin->SetRect(Rect());
}
// ---------------------------------------------------------
// CMyUpForm::CountComponentControls() const
// ---------------------------------------------------------
//
TInt CMyUpForm::CountComponentControls() const
{
return 2; // return nbr of controls inside this container
}
// ---------------------------------------------------------
// CMyUpForm::ComponentControl(TInt aIndex) const
// ---------------------------------------------------------
//
CCoeControl* CMyUpForm::ComponentControl(TInt aIndex) const
{
switch ( aIndex )
{
case 0:
return iLabel;
case 1:
return iEdwin;
default:
return NULL;
}
}
// ---------------------------------------------------------
// CMyUpForm::Draw(const TRect& aRect) const
// ---------------------------------------------------------
//
void CMyUpForm::Draw(const TRect& /*aRect*/) const
{
TPoint p1(iFormRect.iTl.iX + 49, iFormRect.iTl.iY);
TPoint p3(iFormRect.iBr.iX, iFormRect.iBr.iY - 16);
TPoint p2(p1.iX, p3.iY);
CWindowGc& gc = SystemGc();
gc.SetPenStyle( CGraphicsContext::ESolidPen );
gc.DrawLine( p1, p2 );
gc.DrawLine( p2, p3 );
}
// ---------------------------------------------------------
// CMyUpForm::HandleControlEventL(
// CCoeControl* aControl,TCoeEvent aEventType)
// ---------------------------------------------------------
//
void CMyUpForm::HandleControlEventL(
CCoeControl* aControl,TCoeEvent /*aEventType*/)
{
// TODO: Add your control event handler code here
//iFocus = aControl;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -