You Are Here:

Community: Developer Discussion Boards

#1 Old liuxg,help!!! - 2003-05-13, 14:58

Join Date: May 2003
Posts: 63
fengwangjiang
Offline
Regular Contributor
你好,有点问题想请教!
我用view结构写了一个需要显示listbox的程序,
但是一启动程序的时候就报告出现异常 (可以看见程序图标):
“应用程序发生异常unknown software exception (0x80000003),位置在0x6001bb22。
在确定上单击,中止应用程序
在取消上单击,调试应用程序”

这是什么訽因?代码不是很难的,帮我看看好吗?
我的主要代码:

appui创建了一个CMainMenuView(CMainMenuView中包含MainMenuContainer* iContainer),CMainMenuContainer中包含 CAknSingleStyleListBox* iMainMenuListBox;
代码如下:
void CNavboyAppUi::ConstructL()
{
BaseConstructL();
CMainMenuView* MainMenuView = new (ELeave) CMainMenuView;

CleanupStack::PushL( MainMenuView );
MainMenuView->ConstructL();
AddViewL( MainMenuView ); // transfer ownership to CAknViewAppUi
CleanupStack::Pop(); // MainMenuView

CCityMapView* CityMapView = new (ELeave) CCityMapView;

CleanupStack::PushL( CityMapView );
CityMapView->ConstructL();
AddViewL( CityMapView ); // transfer ownership to CAknViewAppUi
CleanupStack::Pop(); // CityMapView

SetDefaultViewL(*MainMenuView);

}

void CMainMenuView::ConstructL()
{
BaseConstructL( R_NAVBOY_MAINMENUVIEW );

//construct the poiner iContainer
iContainer = new (ELeave) CMainMenuContainer;
CleanupStack::PushL( iContainer );
iContainer->SetMopParent(this);
iContainer->ConstructL( ClientRect( ) );

AppUi( )->AddToStackL( *this, iContainer );
//CleanupStack::Pop( iContainer );
}

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

iMainMenuListBox = new (ELeave) CAknSingleStyleListBox( );
CleanupStack::PushL( iMainMenuListBox );
//创建LISTBOX类型
iMainMenuListBox->ConstructL( this, EAknListBoxSelectionList);
//创建SCROLLBAR
iMainMenuListBox->CreateScrollBarFrameL(ETrue);
iMainMenuListBox->ScrollBarFrame()->SetScrollBarVisibilityL(CEikScrollBarFrame::EOff, CEikScrollBarFrame::EAuto);
//从资源中创建LISTBOX
TResourceReader reader;
iEikonEnv->CreateResourceReaderLC( reader, R_NAVBOY_MAINMENU_SINGLE );
iMainMenuListBox->ConstructFromResourceL( reader );
CleanupStack::PopAndDestroy(); // resource stuffs.
//设置容器窗口
iMainMenuListBox->SetContainerWindowL( *this );
//设置OBSERVER
iMainMenuListBox->SetObserver( this );
//设置大小尺寸,位置
iMainMenuListBox->SetRect( aRect );
//iMainMenuListBox->SetExtent( TPoint(0,0)

//SetRect(aRect);
ActivateL();
}

我选择的是支持创建document file的view,我把上面出现的函数中的创建iContainer和i
MainMenuListBox去掉,还是出现同样的异常问题.
感谢!
Reply With Quote

#2 Old 2003-05-14, 04:28

Join Date: Mar 2003
Posts: 3,175
Location: Beijing
Send a message via MSN to liuxg
liuxg's Avatar
liuxg
Offline
Forum Nokia Expert
Hi,

Since I do not have whole view of your code (class inheritance etc), I do not quite understand how your code is contructed!

I suggest you to read the document located at the following location:

\Symbian\6.1\Series60\Series60Doc\Application framework handbook.pdf

It will tell you the application architectures:

1) Traditional Symbian OS Control Architecture
2) Dialog Based Architecture
3) View Architecture

From your code, I can see that your architecture does fall into any of them. Maybe this produces the problem.

When you use the VC++ wizard, you can easily generate the template for all these sample code. Please have a try.

For your information, examples can be found for them

1) Chinese Display Example Application v1.0 for the Series 60 Platform
http://www.forum.nokia.com/files/nds...3,2905,00.html

2) You can easily generate using VC++ wizard

3) \Symbian\6.1\Series60\Series60Ex\MultiViews


Hope this helps!

Liuxg
Forum Nokia
Reply With Quote

#3 Old To liuxg - 2003-05-14, 05:43

Join Date: May 2003
Posts: 63
fengwangjiang
Offline
Regular Contributor
谢谢你每次的热心指点,我看过关于framework的文档,
我的代码也是用VC++的WIZARD创建出来的。
但是我就是找不到错误所在的地方,我仔细地检查过,还是看不出来。
我也求助其他人,但是没有结果。
再帮我看看好吗?这是我的类的主要接口,再次感谢你!
class CNavboyApp : public CAknApplication
{

public:
private:
CApaDocument* CreateDocumentL();
TUid AppDllUid() const;
};

class CNavboyDocument : public CAknDocument
{
public:
static CNavboyDocument* NewL(CEikApplication& aApp);
virtual ~CNavboyDocument();
public: // from CEikDocument
CFileStore* OpenFileL(TBool aDoOpen,const TDesC& aFilename,RFs& aFs);

private:
CNavboyDocument(CEikApplication& aApp);
void ConstructL();

private:
CEikAppUi* CreateAppUiL();
};

class CNavboyAppUi : public CAknViewAppUi
{
public:
void ConstructL();
~CNavboyAppUi();

private:

void DynInitMenuPaneL(TInt aResourceId,CEikMenuPane* aMenuPane);

private:

void HandleCommandL(TInt aCommand);


virtual TKeyResponse HandleKeyEventL(
const TKeyEvent& aKeyEvent,TEventCode aType);

private: //Data
CAknNavigationControlContainer* iNaviPane;
CAknTabGroup* iTabGroup;
CAknNavigationDecorator* iDecoratedTabGroup;
};

class CMainMenuView : public CAknView
{
public:
void ConstructL();
~CMainMenuView();

public:
TUid Id() const;

void HandleCommandL(TInt aCommand);

void HandleClientRectChange();

private:

void DoActivateL(const TVwsViewId& aPrevViewId,TUid aCustomMessageId,
const TDesC8& aCustomMessage);
void DoDeactivate();

private: // Data
CMainMenuContainer* iContainer;
};

class CMainMenuContainer : public CCoeControl, MCoeControlObserver
{
public: // Constructors and destructor

void ConstructL(const TRect& aRect);

~CMainMenuContainer();

public: // New functions

public: // Functions from base classes
TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent, TEventCode aType );

private: // Functions from base classes

void SizeChanged();
TInt CountComponentControls() const;
CCoeControl* ComponentControl(TInt aIndex) const;
void Draw(const TRect& aRect) const;
void HandleControlEventL(CCoeControl* aControl,TCoeEvent aEventType);

private:
CAknSingleStyleListBox* iMainMenuListBox; //manimenu
};
Reply With Quote

#4 Old 2003-05-14, 05:55

Join Date: Mar 2003
Posts: 3,175
Location: Beijing
Send a message via MSN to liuxg
liuxg's Avatar
liuxg
Offline
Forum Nokia Expert
Hi,

Please study the code:

\Symbian\6.1\Series60\Series60Ex\MultiViews

From there, you can see:

TUid CMultiViewsView2::Id() const
{
return TUid::Uid(EMultiViewsView2Id);
}

void CMultiViewsView2:oActivateL(const TVwsViewId& /*aPrevViewId*/,
TUid /*aCustomMessageId*/,
const TDesC8& /*aCustomMessage*/)
{
ASSERT(iContainer == NULL);
iContainer = CMultiViewsContainer2::NewL(ClientRect());
}

void CMultiViewsView2:oDeactivate()
{
if (iContainer)
{
AppUi()->RemoveFromStack(iContainer);
delete iContainer;
iContainer = NULL;
}
}

The container class is generated and destroyed in the above two places. However, your code constructed it in the function "ContructL()". This may give you the problem. If I understand correctly, the default implementation of the wizard is not like the way you are implementing!!!

Hope this help!

Good luck to you!

Liuxg
Forum Nokia
Reply With Quote

#5 Old To liuxg - 2003-05-14, 19:15

Join Date: May 2003
Posts: 63
fengwangjiang
Offline
Regular Contributor
谢谢你的指点,我在仔细检查一下。谢谢你!
Reply With Quote
Reply « Previous Thread | Next Thread »
Display Modes
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules

You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Rate This

 
Bookmark this page: DeliciousDiggFacebookGoogleYahooStumbleUponRedditDiigoTechnocratiTwitter  Share this page Share this page Print this Page Print this page Invite a friend Invite a friend
京ICP备05048969号    Email Newsletters Press Terms & Conditions Privacy Policy Sitemap Contact Us © 2009 Nokia