void CSwitchAppUi::HandleCommandL(TInt aCommand)
{
switch ( aCommand )
{
case ESwitchCmdAppView2:
{
ActivateLocalViewL(TUid::Uid(ESwitchView2Tab));
break;
}
// TODO: Add Your command handling code here
default:
break;
}
}
i get the error
Switchcontainer.cpp
C:\AMBADAS\SWITCH\SRC\Switchcontainer.cpp(198) : error C2065: 'AppUi' : undeclared identifier
C:\AMBADAS\SWITCH\SRC\Switchcontainer.cpp(198) : error C2227: left of '->HandleCommandL' must point to class/struct/union
Error executing cl.exe.
AppUi() is a member function of CAknView. If your container is derived from CCoeControl, then it does not have this API. This is why it does not work for you. Please check your code, or post your code here. In this case, I can help you to solve your problem.
// INCLUDES
#include <coecntrl.h>
#include <eiklbo.h>
// FORWARD DECLARATIONS
class CEikLabel; // for example labels
class CEikTextListBox;
class CEikColumnListBox;
// CLASS DECLARATION
class CSwitchContainer : public CCoeControl,MEikListBoxObserver// MCoeControlObserver
{
public: // Constructors and destructor
public: // Functions from base classes
int InitListBox();
CEikColumnListBox *iListBox;
void HandleListBoxEventL(CEikListBox *aListBox, TListBoxEvent aEventType);
TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent, TEventCode aType);
TBuf<100> TmpNm;
private: // Functions from base classes
void SizeChanged();
TInt CountComponentControls() const;
CCoeControl* ComponentControl(TInt aIndex) const;
void Draw(const TRect& aRect) const;
private: //data
CEikLabel* iLabel; // example label
CEikLabel* iToDoLabel; // example label
};
#endif
// End of File
*************************************************************************************************************************************************
Switchcontainer.cpp
if (iListBox)
{
iListBox->UpdateScrollBarsL();
return iListBox->OfferKeyEventL(aKeyEvent, aType);
}
return EKeyWasNotConsumed;
}
// End of File
**********************************************************************
SwitchAppUi.cpp
/*
* ============================================================================
* Name : CSwitchAppUi from SwitchAppUi.cpp
* Part of : Switch
* Created : 04/23/2003 by
* Implementation notes:
* Initial content was generated by Series 60 AppWizard.
* Version :
* Copyright:
* ============================================================================
*/
// Show tabs for main views from resources
CEikStatusPane* sp = StatusPane();
// Fetch pointer to the default navi pane control
iNaviPane = (CAknNavigationControlContainer*)sp->ControlL(
TUid::Uid(EEikStatusPaneUidNavi));
// Tabgroup has been read from resource and it were pushed to the navi pane.
// Get pointer to the navigation decorator with the ResourceDecorator() function.
// Application owns the decorator and it has responsibility to delete the object.
iDecoratedTabGroup = iNaviPane->ResourceDecorator();
if (iDecoratedTabGroup)
{
iTabGroup = (CAknTabGroup*) iDecoratedTabGroup->DecoratedControl();
}
CSwitchView* view1 = new (ELeave) CSwitchView;
CleanupStack::PushL( view1 );
view1->ConstructL();
AddViewL( view1 ); // transfer ownership to CAknViewAppUi
CleanupStack::Pop(); // view1
CSwitchView2* view2 = new (ELeave) CSwitchView2;
CleanupStack::PushL( view2 );
view2->ConstructL();
AddViewL( view2 ); // transfer ownership to CAknViewAppUi
CleanupStack::Pop(); // view2
I do not quite understand your question. Could you please elaborate it more? Your "CSwitchContainer" should be used inside one of your views (either CSwitchView or CSwitchView2 ). That part of code is missing (not here).
that's clear!
HandleCommand is not a memeber of AppUi, what you haven't defined. I think you will use the upper class of your Appui and then it's right!
Re: open a view by clicking the listbox item
2006-02-24, 15:55#6