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

Error when activating setting list view

0 replies · 3,513 views · Started 22 February 2006

Hi
On Nokia 6600
Using the code below ,
I get this error message when opening the Setting List view:
"Out of memory.Try closing unnessary applications".
This happens only on the Emulator ,
and this is the only application I open on it .
On the device the view is opened with no errors ,
but ofcourse I need to test things on the emulator ...
(By the way , other views opened just fine in the app ...)

I tried looking up this error and got nothing useful ,
Do you have any idea about this problem and how to solve it ?

Thank you & have a great day

//### SETTING VIEW ###

const TUid KViewId = {1};

CMyAppSettingView* CMyAppSettingView::NewLC()
{
CMyAppSettingView* self = new (ELeave) CMyAppSettingView();
CleanupStack::PushL(self);
self->ConstructL();
return self;
}

CMyAppSettingView* CMyAppSettingView::NewL()
{
CMyAppSettingView* self = CMyAppSettingView::NewLC();
CleanupStack::Pop(self);
return self;
}

void CMyAppSettingView::ConstructL()
{
BaseConstructL(R_SETTING_VIEW);
}

CMyAppSettingView::CMyAppSettingView(): CAknView(){}

void CMyAppSettingView:😃oActivateL(const TVwsViewId&,TUid,const TDesC8&😉
{
if(!iSettingList)
{
iSettingList = CSettingList::NewL();
iSettingList->SetMopParent(this);
TResourceReader reader;
CEikonEnv::Static()->CreateResourceReaderLC(reader, R_SETTINGS);
iSettingList->ConstructFromResourceL(reader);
CleanupStack::PopAndDestroy();
AppUi()->AddToViewStackL(*this, iSettingList);
iSettingList->ActivateL();
}
}

TUid CMyAppSettingView::Id() const{return KViewId;}

//### SETTING LIST ###

CSettingList *CSettingList::NewL()
{
CSettingList* self = CSettingList::NewLC();
CleanupStack::Pop(self);
return self;
}

CSettingList *CSettingList::NewLC()
{
CSettingList* self = new (ELeave) CSettingList();
CleanupStack::PushL(self);
return self;
}

CSettingList::CSettingList():CAknSettingItemList(){}

void CSettingList::SizeChanged()
{
CEikFormattedCellListBox *listbox = ListBox();
if (listbox)
{
listbox->SetRect(Rect());
}
}

void CSettingList::EditCurrentItemL()
{
EditItemL(ListBox()->CurrentItemIndex(),ETrue);
}

CAknSettingItem * CSettingList::CreateSettingItemL (TInt aIdentifier)
{
CAknSettingItem* settingItem = NULL;
switch (aIdentifier)
{
case EVal:
{
_LIT(KTEXT,"Text"😉;
TBuf<100> buf;
buf.Append(KTEXT);
settingItem = new (ELeave) CAknTextSettingItem(aIdentifier,buf);
}
break;
default:
break;
}
return settingItem;
}

// ### MYAPPUI.CPP ###
// ConstructL:
iMyAppSettingView = CMyAppSettingView::NewLC();
AddViewL(iMyAppSettingView);
CleanupStack::Pop(iMyAppSettingView);

// Opening the setting view when setting option is chosen:
AppUi()->ActivateLocalViewL(iMyAppSettingView->Id());

// ### RSS FILE ###

RESOURCE AVKON_VIEW r_setting_view
{
menubar = r_setting_menubar;
cba = R_AVKON_SOFTKEYS_OPTIONS_BACK;
}

RESOURCE MENU_BAR r_setting_menubar
{
titles =
{
MENU_TITLE
{
menu_pane = r_setting_menu;
}
};
}

RESOURCE MENU_PANE r_setting_menu
{
items=
{
MENU_ITEM
{
command = EEdit;
txt = "Edit";
}
};
}

RESOURCE AVKON_SETTING_ITEM_LIST r_settings
{
title = "Setup";
items =
{
AVKON_SETTING_ITEM
{
identifier = EVal;
setting_page_resource = r_val;
name = "Editor";
}
};
}

RESOURCE EDWIN r_val {maxlength = 100;}