Read-only archive of the All About Symbian forum (2001–2013) · About this archive

ListBox woes (KERN-EXEC 3)

5 replies · 7,745 views · Started 05 March 2003

Hi,

I'm wondering someone can help me with a ListBox problem. I'm trying to construct and display a ListBox in the container of my application. The ConstructL function looks like:

void CLbtestContainer::ConstructL(const TRect& aRect)
{
CreateWindowL();

iListBox = new (ELeave) CAknSingleStyleListBox;
iListBox->SetContainerWindowL(*this);
iListBox->ConstructL(this, EAknListBoxSelectionList);

array = new (ELeave) CDesCArrayFlat(5);
array->AppendL(_L("\tItem1"😉);
array->AppendL(_L("\tItem2"😉);
array->AppendL(_L("\tItem3"😉);
array->AppendL(_L("\tItem4"😉);
array->AppendL(_L("\tItem5"😉);
iListBox->Model()->SetItemTextArray(array);

iListBox->CreateScrollBarFrameL(ETrue);
iListBox->ScrollBarFrame()->SetScrollBarVisibilityL(CEikScrollBarFrame::EOff, CEikScrollBarFrame::EAuto);

SetRect(aRect);
ActivateL();
}

Everything compiles fine but when I run it in the emulator it instantly crashes. When I run it on my target device (3650) it immediately exits with a KERN-EXEC 3 panic. I've looked up the panic message but I'm still lost on what could be causing the problem. I would appreciate any feedback you can give. Thank you!

Regards,
Dennis

What does your
TInt CLbtestContainer::CountComponentControls() const
{
return 1; // return nbr of controls inside this container
}

and

CCoeControl* CLbtestContainer::ComponentControl(TInt aIndex) const
{
if (aIndex == 0)
return iListBox;
return NULL;
}

say?

Best regards,
Teemu Moilanen

First of all, let me start by saying that I don't know the CAknSingleStyleListBox class at all. It is not part of my sdk. But, having said that, here are some questions and a suggestion.

1. What is the exact definition of CAknSingleStyleListBox::ConstructL ?
2. What is the class name of the model used by the listbox ? (e.g. CTextListBoxModel)
3. Is the listbox constructing the model, or do you need to do it ?

I would suggest that you change the following code from
[code:1]array = new (ELeave) CDesCArrayFlat(5);
array->AppendL(_L("\tItem1"));
array->AppendL(_L("\tItem2"));
array->AppendL(_L("\tItem3"));
array->AppendL(_L("\tItem4"));
array->AppendL(_L("\tItem5"));
iListBox->Model()->SetItemTextArray(array); [/code:1]
to [code:1]CDesCArray* array = (CDesCArray*)iListBox->Model()->ItemTextArray();
array->AppendL(_L("\tItem1"));
array->AppendL(_L("\tItem2"));
array->AppendL(_L("\tItem3"));
array->AppendL(_L("\tItem4"));
array->AppendL(_L("\tItem5")); [/code:1]

A couple of things to try:

1. Swap the ConstructL() and SetContainerWindowL() lines around.

2. Add the line
[code:1]iListBox->Model()->SetOwnershipType(ELbmDoesNotOwnItemArray);[/code:1]
before calling SetItemTextArray().

Thanks for the great responses and I did finally come to a solution and it was what emunator suggested. My ComponentControl function was still referencing the default labels inserted by the AppWizard. Thanks for taking the time to help a newbie out and I'm glad to be a part of these great forums!

Regards,
Dennis

Hi,

I'm wondering someone can help me with a ListBox problem. I'm trying to construct and display a ListBox in the container of my application. The ConstructL function looks like:

void CLbtestContainer::ConstructL(const TRect& aRect)
{
CreateWindowL();

iListBox = new (ELeave) CAknSingleStyleListBox;
iListBox->SetContainerWindowL(*this);
iListBox->ConstructL(this, EAknListBoxSelectionList);

array = new (ELeave) CDesCArrayFlat(5);
array->AppendL(_L("\tItem1"😉);
array->AppendL(_L("\tItem2"😉);
array->AppendL(_L("\tItem3"😉);
array->AppendL(_L("\tItem4"😉);
array->AppendL(_L("\tItem5"😉);
iListBox->Model()->SetItemTextArray(array);

iListBox->CreateScrollBarFrameL(ETrue);
iListBox->ScrollBarFrame()->SetScrollBarVisibilityL(CEikScrollBarFrame::EOff, CEikScrollBarFrame::EAuto);

SetRect(aRect);
ActivateL();
}

Everything compiles fine but when I run it in the emulator it instantly crashes. When I run it on my target device (3650) it immediately exits with a KERN-EXEC 3 panic. I've looked up the panic message but I'm still lost on what could be causing the problem. I would appreciate any feedback you can give. Thank you!

Regards,
Dennis


can any body tell me which library is used to access listbox controll for class CAknSingleStyleListBox

i got an error
c:\Symbian\7.0s\Series60_v20\Epoc32\CarSample\inc\CarSampleContainer.h(87): error C2079: 'CCarSampleContainer::iListBox' uses undefined class 'CAknSingleStyleListBox'

c:\Symbian\7.0s\Series60_v20\Epoc32\CarSample\src\CarSampleAppUi.cpp(188): error C2065: 'array' : undeclared identifier

but If i declare
class CAknSingleStyleListBox; // For List Box
class CDesCArrayFlat; // Array

then it will reduce error list and return few errors like

C:\Symbian\7.0s\Series60_v20\\Epoc32\include\badesca.h(213): error C2371: 'CDesCArrayFlat' : redefinition; different basic types

c:\Symbian\7.0s\Series60_v20\Epoc32\CarSample\inc\CarSampleContainer.h(21): fatal error C1001: INTERNAL COMPILER ERROR
(compiler file 'msc1.cpp', line 2701)
Please choose the Technical Support command on the Visual C++
Help menu, or open the Technical Support help file for more information

can anybody solve my problem so i can provide me solution as early as possible.

I want to read contact numbers and put it into listbox for display
can anybody tell me how can i do this ?

Thank you.
Chirag