请问各位高手,如何在CodeWarrier中添加控件?
有没有什么简单的方法?
不能像在VC下那样拖控件吗?
注:(最好能有源码,小弟刚学不久)
------解决方案--------------------------------------------------------
class CxxxContainer : public CCoeControl
{
public: // Constructors and destructor
void ConstructL(const TRect& aRect);
~CxxxContainer();
private: // Functions from base classes
void SizeChanged();
TInt CountComponentControls() const;
CCoeControl* ComponentControl(TInt aIndex) const;
void Draw(const TRect& aRect) const;
TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent, TEventCode aType );
public:
CEikEdwin *iEditor;
};
void CxxxContainer::ConstructL(const TRect& aRect)
{
CreateWindowL();
iEditor = new (ELeave) CEikEdwin;//添加
iEditor-> ConstructL(...); //添加
ActivateL();
}
CxxxContainer::~CxxxContainer()
{
delete iEditor; //添加
}
void CxxxContainer::SizeChanged()
{
iEditor-> SetRect(Rect());//添加
}
TInt CxxxContainer::CountComponentControls() const
{
return 1; //添加
}
CCoeControl* CxxxContainer::ComponentControl(TInt aIndex) const
{
switch ( aIndex )
{
case 0:
return iEditor;//添加
default:
return NULL;
}
}
void CxxxContainer::Draw(const TRect& aRect) const
{
...
}
TKeyResponse CxxxContainer::OfferKeyEventL( const TKeyEvent& aKeyEvent, TEventCode aType ){
return iEditor-> OfferKeyEventL( aKeyEvent, aType );//添加
}