Problem in Multi view
| Thu, 2006-10-26 01:51 | |
|
|
I have some problem with setting list. I try mix setting list from EMCC sample and multi view from default sample of SDK, but i have problem. I can't jump from 1 item list to other. please help me this my settinglist container code -------------------------------------------------------------------------- /* Copyright (c) 2003, Nokia. All rights reserved */ #include <coemain.h> #include <WAPServ.rsg> #include "WAPServContainerSetting.h" #include "WAPServSettingItemsList.h" CWAPServContainerSetting* CWAPServContainerSetting::NewL(const TRect& aRect) { CWAPServContainerSetting* self = CWAPServContainerSetting::NewLC(aRect); CleanupStack::Pop(self); return self; } CWAPServContainerSetting* CWAPServContainerSetting::NewLC(const TRect& aRect) { CWAPServContainerSetting* self = new (ELeave) CWAPServContainerSetting; CleanupStack::PushL(self); self->ConstructL(aRect); return self; } void CWAPServContainerSetting::ConstructL(const TRect& aRect) { iSettingItemList = new CWAPServSettingItemsList(iSetting); iSettingItemList->SetMopParent(this); iSettingItemList->ConstructFromResourceL(R_WAPSERV_SETTING_ITEM_LIST); SetRect(aRect); ActivateL(); } CWAPServContainerSetting::CWAPServContainerSetting() { // no implementation required } CWAPServContainerSetting::~CWAPServContainerSetting() { delete iSettingItemList; } TInt CWAPServContainerSetting::CountComponentControls() const { return 1; } void CWAPServContainerSetting::Draw(const TRect& /*aRect*/) const { // Get the standard graphics context CWindowGc& gc = SystemGc(); // Gets the control's extent TRect rect = Rect(); // Clears the screen gc.Clear(rect); } CCoeControl* CWAPServContainerSetting::ComponentControl(TInt aIndex) const { switch (aIndex) { case 0: return iSettingItemList; default: return NULL; } } TKeyResponse CWAPServContainerSetting::OfferKeyEventL(const TKeyEvent& aKeyEvent, TEventCode aType) { if (iSettingItemList) return iSettingItemList->OfferKeyEventL(aKeyEvent, aType); else return EKeyWasNotConsumed; } void CWAPServContainerSetting::ChangeSelectedItemL() { if (iSettingItemList) iSettingItemList->ChangeSelectedItemL(); } --------------------------------------------------------------------------------- my setting list view code -------------------------------------------------------------------------------- /* Copyright (c) 2003, Nokia. All rights reserved */ #include <aknviewappui.h> #include <aknconsts.h> #include <aknnotewrappers.h> #include <WAPServ.rsg> #include "WAPServViewSetting.h" #include "WAPServContainerSetting.h" #include "WAPServ.hrh" CWAPServViewSetting* CWAPServViewSetting::NewL() { CWAPServViewSetting* self = CWAPServViewSetting::NewLC(); CleanupStack::Pop(self); return self; } CWAPServViewSetting* CWAPServViewSetting::NewLC() { CWAPServViewSetting* self = new (ELeave) CWAPServViewSetting(); CleanupStack::PushL(self); self->ConstructL(); return self; } CWAPServViewSetting::CWAPServViewSetting() { // No implementation required } CWAPServViewSetting::~CWAPServViewSetting() { // No implementation required } void CWAPServViewSetting::ConstructL() { BaseConstructL(R_WAPSERV_VIEW_SETTING); } TUid CWAPServViewSetting::Id() const { return TUid::Uid(EWAPServViewSettingId); } void CWAPServViewSetting::DoActivateL(const TVwsViewId& /*aPrevViewId*/, TUid /*aCustomMessageId*/, const TDesC8& /*aCustomMessage*/) { ASSERT(!(iContainer)); iContainer = CWAPServContainerSetting::NewL(ClientRect()); } void CWAPServViewSetting::DoDeactivate() { if (iContainer) { AppUi()->RemoveFromStack(iContainer); delete iContainer; iContainer = NULL; } } void CWAPServViewSetting::HandleCommandL(TInt aCommand) { if (aCommand == EMultiViewsCommand1) { _LIT(message,"Hello"); CAknInformationNote* informationNote = new (ELeave) CAknInformationNote; informationNote->ExecuteLD(message); } else if (aCommand == /*EWAPServSwitchToViewApplication*/EAknSoftkeyBack) { AppUi()->ActivateLocalViewL(TUid::Uid(EWAPServViewApplicationId)); } else if (aCommand == EWAPServCmdChange) { iContainer->ChangeSelectedItemL(); } else { AppUi()->HandleCommandL(aCommand); } } ---------------------------------------------------------------------------------------- and my appui code ---------------------------------------------------------------------------------------- #include <e32std.h> #include <avkon.hrh> #include <aknnotewrappers.h> #include "WAPServ.pan" #include "WAPServAppUi.h" #include "WAPServViewApplication.h" #include "WAPServViewSetting.h" #include "WAPServ.hrh" // ConstructL is called by the application framework void CWAPServAppUi::ConstructL() { BaseConstructL(EAknEnableSkin); iAppViewApplication = CWAPServViewApplication::NewL(); iAppViewSetting = CWAPServViewSetting::NewL(); AddViewL(iAppViewApplication); // Transfer ownership to base class AddViewL(iAppViewSetting); // Transfer ownership to base class SetDefaultViewL(*iAppViewApplication); } // handle any menu commands void CWAPServAppUi::HandleCommandL(TInt aCommand) { switch(aCommand) { case EEikCmdExit: case EAknSoftkeyExit: Exit(); break; //case EWAPServStartApplication: //_LIT(startMessage,"Start"); //CAknInformationNote* startNote = new (ELeave) CAknInformationNote; //startNote->ExecuteLD(startMessage); //iAppViewApplication->StartApplicationL(); //break; case EWAPServStopApplication: _LIT(stopMessage,"Stop"); CAknInformationNote* stopNote = new (ELeave) CAknInformationNote; stopNote->ExecuteLD(stopMessage); break; default: Panic(EWAPServBasicUi); break; } } ----------------------------------------------------------------------------- Belajar symbian nggo masa depan. |






Forum posts: 22
Belajar symbian nggo masa depan.
Forum posts: 3
The view has no containers as of now.
I am getting a Program closed error after the Exit command
the view doesnt get deleted in the destructor.
//the VIEW code is as follows
#include <aknviewappui.h>
#include <Editor.rsg>
#include "Editor.hrh"
#include "EditorAppView.h"
// Standard construction sequence
CEditorAppView* CEditorAppView::NewL()
{
CEditorAppView* self = CEditorAppView::NewLC();
CleanupStack::Pop(self);
return self;
}
CEditorAppView* CEditorAppView::NewLC()
{
CEditorAppView* self = new (ELeave) CEditorAppView();
CleanupStack::PushL(self);
self->ConstructL();
return self;
}
CEditorAppView::CEditorAppView()
{
// No implementation required
}
CEditorAppView::~CEditorAppView()
{
}
void CEditorAppView::ConstructL()
{
BaseConstructL(R_EDITOR_MAINVIEW);
}
TUid CEditorAppView::Id() const
{
return TUid::Uid(EViewId);
}
void CEditorAppView::DoActivateL(const TVwsViewId& /*aPrevViewId*/,
TUid /*aCustomMessageId*/,
const TDesC8& /*aCustomMessage*/)
{
}
void CEditorAppView::DoDeactivate()
{
}
void CEditorAppView::HandleCommandL(TInt aCommand)
{
AppUi()->HandleCommandL(aCommand);
}
///////////////////////////////////////////////////////////
The AppUi code is as follows
#include <avkon.hrh>
#include <aknnotewrappers.h>
#include "Editor.pan"
#include "EditorAppUi.h"
#include "EditorAppView.h"
#include "Editor.hrh"
// ConstructL is called by the application framework
void CEditorAppUi::ConstructL()
{
BaseConstructL();
iAppView = CEditorAppView::NewL();
AddViewL(iAppView);
SetDefaultViewL(*iAppView);
}
CEditorAppUi::CEditorAppUi()
{
// no implementation required
}
CEditorAppUi::~CEditorAppUi()
{
if (iAppView)
{
RemoveView(iAppView->Id());
delete iAppView;
iAppView = NULL;
}
}
// handle any menu commands
void CEditorAppUi::HandleCommandL(TInt aCommand)
{
switch(aCommand)
{
case EEikCmdExit:
case EAknSoftkeyExit:
Exit();
break;
case EEditorCmdSave:
{
_LIT(message,"Hello!");
CAknInformationNote* informationNote = new (ELeave) CAknInformationNote;
informationNote->ExecuteLD(message);
}
break;
default:
Panic(EEditorBasicUi);
break;
}
}
Forum posts: 3
but i dont understand why we arent supposed to delete the View object