Re-Draw of listbox

Login to reply to this topic.
Mon, 2007-11-05 18:14
Joined: 2004-10-07
Forum posts: 47

Hi All,
My code works ok in emulator, but when i installed on mobile(E61 3rd edition) it is not re-draw the list box.... pls see this code and help me out... thanks in advance

***********************.h**************************
#ifndef TestListCONTAINER_H
#define TestListCONTAINER_H

class CTestListContainer : public CCoeControl, MCoeControlObserver, MEikListBoxObserver
{
public:
void ConstructL(const TRect& aRect);
~CTestListContainer();
private:
void SizeChanged();
TInt CountComponentControls() const;
CCoeControl* ComponentControl(TInt aIndex) const;
void Draw(const TRect& aRect) const;
void HandleControlEventL(CCoeControl* aControl,TCoeEvent aEventType);
TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType);
void HandleListBoxEventL(CEikListBox*, TListBoxEvent aEventType);
private: //data
CEikTextListBox* iListBox;
CDesCArray* iItemList;
};
#endif // End of File
******************************************************

**************************************.cpp************************************

void CTestListContainer::ConstructL(const TRect& aRect)
{
CreateWindowL();
iItemList = new (ELeave) CDesCArrayFlat( 5 );
_LIT(KListOItemFormatter,"\tdata\t\t");
iItemList->AppendL(KListOItemFormatter);
iItemList->AppendL(KListOItemFormatter);
iItemList->AppendL(KListOItemFormatter);

// Create Listbox
iListBox = new (ELeave) CAknSingleStyleListBox;

if ( iListBox )
{
iListBox->ConstructL( NULL, EAknListBoxSelectionList );
iListBox->Model()->SetItemTextArray( iItemList );
iListBox->CreateScrollBarFrameL();
iListBox->Model()->SetOwnershipType( ELbmDoesNotOwnItemArray );
iListBox->SetListBoxObserver( this );
iListBox->HandleItemAdditionL();
}
SetRect(aRect);
ActivateL();
}

CTestListContainer::~CTestListContainer()
{
delete iListBox;
delete iItemList;

}

void CTestListContainer::SizeChanged()
{
const TPoint listPosition(0,0);
iListBox->SetExtent(listPosition, iListBox->MinimumSize());
}

TInt CTestListContainer::CountComponentControls() const
{
return 1;
}

CCoeControl* CTestListContainer::ComponentControl(TInt aIndex) const
{
switch (aIndex)
{
case 0:
return (iListBox);
default:
return (NULL);
}
}

void CTestListContainer::Draw(const TRect& aRect) const
{
CWindowGc& gc = SystemGc();
TRect rect = Rect();
gc.SetPenStyle( CGraphicsContext::ESolidPen );
gc.SetBrushColor( KRgbWhite );
gc.SetBrushStyle( CGraphicsContext::ESolidBrush );
gc.DrawRect( aRect );
}

void CTestListContainer::HandleControlEventL(CCoeControl* /*aControl*/,TCoeEvent /*aEventType*/)
{
}

TKeyResponse CTestListContainer::OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType)
{
if ( aType != EEventKey )
{
return EKeyWasNotConsumed;
}

return (iListBox->OfferKeyEventL(aKeyEvent, aType));

}
void CTestListContainer::HandleListBoxEventL(CEikListBox*, TListBoxEvent aEventType)
{

}

************************************************************************************


Thanks & Regards,
Symbi


Wed, 2008-03-05 12:40
Joined: 2008-02-18
Forum posts: 2
Re: Re-Draw of listbox

The same problem. Is there any solution?

Wed, 2008-03-05 12:49
Joined: 2004-10-07
Forum posts: 47
Re: Re-Draw of listbox

Dieworld,
Add "BaseConstructL(EAknEnableSkin)" line of code in appui ConstructL funcation


Thanks & Regards,
Symbi

  • Login to reply to this topic.