×

Discussion Board

Results 1 to 8 of 8
  1. #1
    Registered User
    Join Date
    Oct 2006
    Posts
    5

    the problem this listbox with images

    There is my code
    *.cpp file
    Code:
    #include "NumberSwitchContainer.h"
    #include <akniconarray.h>
    #include <eiktxlbx.h>
    #include <aknlists.h>
    #include <barsread.h>
    #include <avkon.mbg>
    #include "Numberswitch.rsg"
    const TInt KGranularityOfArray = 10;
    void CNumberSwitchContainer::CreateListBox()
    {
    if ( iListBox )
    		{
    		delete iListBox;
    		iListBox = NULL;
    		}
    	// listbox instance
    	iListBox = new (ELeave) CEikFormattedCellListBox();
    	//iListBox->ConstructL(this, EAknListBoxSelectionList);
    	iListBox->SetContainerWindowL(*this); 
    	// add scrollbars to listbox 
    	iListBox->CreateScrollBarFrameL(ETrue); 
    	iListBox->ScrollBarFrame()->SetScrollBarVisibilityL( CEikScrollBarFrame::EOn,
    	CEikScrollBarFrame::EAuto ); 
    	const TPoint aPoint(0,0);
    	const TSize aSize(180,150);
    	//most important line , else the list box simply disappears
    	iListBox->SetExtent(aPoint,aSize);		
    	//Fill list box with the data
    	InitListBox();
    	iListBox->ActivateL();
    	iListBox->DrawNow();
    	iCtrlArray.Append( iListBox );
    }
    void CNumberSwitchContainer::InitListBox()
    {
    CDesCArray *itemList = new (ELeave) CDesCArrayFlat(KGranularityOfArray); 
    	itemList->AppendL(_L("0\tItem01"));
    	itemList->AppendL(_L("1\tItem02"));
    	itemList->AppendL(_L("2\tItem03"));
    	// set items and ownership 
    	iListBox->Model()->SetItemTextArray(itemList); 
    	iListBox->Model()->SetOwnershipType(ELbmOwnsItemArray); 
    	iListBox->SetCurrentItemIndex(0);
    	iListBox->SetFocus(ETrue);
    	CArrayPtr<CGulIcon>* iconList = new (ELeave) CAknIconArray(KGranularityOfArray);
    	CleanupStack::PushL(iconList); 
    	_LIT( KIconFile,"z:\\system\\data\\avkon.mbm");
    	iconList->AppendL( iEikonEnv->CreateIconL( KIconFile, EMbmAvkonQgn_note_ok, EMbmAvkonQgn_note_ok_mask) );
    	iconList->AppendL( iEikonEnv->CreateIconL( KIconFile, EMbmAvkonQgn_note_bt, EMbmAvkonQgn_note_bt_mask) );
    	iconList->AppendL( iEikonEnv->CreateIconL( KIconFile, EMbmAvkonQgn_note_sml, EMbmAvkonQgn_note_sml_mask) );
    	iListBox->ItemDrawer()->ColumnData()->SetIconArray( iconList );
    	CleanupStack::Pop(); // iconList 
    	iListBox->HandleItemAdditionL();
    }
    void CNumberSwitchContainer::ConstructL(const TRect& aRect)
    {
       CreateWindowL();
       CreateListBox();
       SetRect(aRect);
       ActivateL();
    }
    // Destructor
    CNumberSwitchContainer::~CNumberSwitchContainer()
        {
       delete iListBox;
        }
    void CNumberSwitchContainer::SizeChanged()
        {
    iListBox->SetExtent(TPoint(10, 10), iListBox->MinimumSize());
         }
    
    TInt CNumberSwitchContainer::CountComponentControls() const
        {
        return 1; // return nbr of controls inside this container
        }
    
    CCoeControl* CNumberSwitchContainer::ComponentControl(TInt aIndex) const
        {
        switch ( aIndex )
            {
            	case 0:
            	return iListBox;
            default:
            return NULL;
            }
        }
    void CNumberSwitchContainer::Draw(const TRect& aRect) const
        {
        CWindowGc& gc = SystemGc();
        gc.SetPenStyle( CGraphicsContext::ENullPen );
        gc.SetBrushColor( KRgbGray );
        gc.SetBrushStyle( CGraphicsContext::ESolidBrush );
        gc.DrawRect( aRect );
        }
    void CNumberSwitchContainer::HandleControlEventL(
        CCoeControl* /*aControl*/,TCoeEvent /*aEventType*/)
        {    }
    and the *.h file
    Code:
    ...
            CEikFormattedCellListBox* iListBox;
           	RPointerArray<CCoeControl> iCtrlArray;
    ...
    when i compile the project i have errors:
    Undefined symbol: 'CDesC16ArrayFlat::CDesC16ArrayFlat(int) (??0CDesC16ArrayFlat@@QAE@H@Z)' referenced from 'void CNumberSwitchContainer::InitListBox(void) (?InitListBox@CNumberSwitchContainer@@AAEXXZ)' in NumberSwitchContainer.cpp:56 NumberSwitch line 0 20
    2 Undefined symbol: 'void CDesC16Array::AppendL(class TDesC16 const &) (?AppendL@CDesC16Array@@QAEXABVTDesC16@@@Z)' referenced from 'void CNumberSwitchContainer::InitListBox(void) (?InitListBox@CNumberSwitchContainer@@AAEXXZ)' in NumberSwitchContainer.cpp:58 referenced from 'void CNumberSwitchContainer::InitListBox(void) (?InitListBox@CNumberSwitchContainer@@AAEXXZ)' in NumberSwitchContainer.cpp:59 referenced from 'void CNumberSwitchContainer::InitListBox(void) (?InitListBox@CNumberSwitchContainer@@AAEXXZ)' in NumberSwitchContainer.cpp:60 NumberSwitch line 0 20

    58,59,60 strings are:
    Code:
    	itemList->AppendL(_L("0\tItem01"));
    	itemList->AppendL(_L("1\tItem02"));
    	itemList->AppendL(_L("2\tItem03"));
    Where is my mistake?

  2. #2
    Super Contributor
    Join Date
    Oct 2005
    Location
    Hyderabad,India
    Posts
    1,156

    Re: the problem this listbox with images

    Hello Aykis,
    Welcome to Nokia Forumz!
    check whether you have included badesca.h and Linked against bafl.lib.
    i think you get the undefined symbol as you have not included the headers.

    Best Regrdz
    Priju

  3. #3
    Registered User
    Join Date
    Oct 2006
    Posts
    5

    Re: the problem this listbox with images

    Yep, it helped, thanks
    But now, when i start the app on emulator, it is crashing :(

  4. #4
    Super Contributor
    Join Date
    Oct 2005
    Location
    Hyderabad,India
    Posts
    1,156

    Re: the problem this listbox with images

    Quote Originally Posted by Aykis
    Yep, it helped, thanks
    But now, when i start the app on emulator, it is crashing :(

    What is the Panic code that you get?
    you would be able to get the extended panic code by following this link..
    http://newlc.com/Display-the-extende...c-code-in.html

    and also debug your code and find where does it panic...

    Bst Regrdz
    Priju

  5. #5
    Nokia Developer Champion
    Join Date
    Mar 2006
    Location
    Helsinki, Finland
    Posts
    8,344

    Smile Re: the problem this listbox with images

    Hello AyKis,

    Assuming that you are using S60 2nd Edition.
    Create one empty File named: ErrRd in the following path:
    C:\Symbian\8.0a\S60_2nd_FP2\epoc32\wins\c\System\Bootdata\
    It will give you an error code when there is a problem with yr code, mostly.

    EDIT: Enable the Extended panic option from the preferences of the emulator

    Regards.
    Kiran.
    Last edited by kiran10182; 2006-10-20 at 10:52.

  6. #6
    Registered User
    Join Date
    Oct 2006
    Posts
    5

    Re: the problem this listbox with images

    Yes, i'm using S60 2nd Edition. I done, that you said, but ErrRd is empty...

  7. #7
    Super Contributor
    Join Date
    Oct 2005
    Location
    Hyderabad,India
    Posts
    1,156

    Re: the problem this listbox with images

    Quote Originally Posted by kiran10182
    Create one empty File named: ErrRd in the following path:
    C:\Symbian\8.0a\S60_2nd_FP2\epoc32\wins\c\System\Bootdata\
    It will give you an error code when there is a problem with yr code,
    Yea,You must be having a EMPTY FILE named ErrRd as Kiran said.so need not worry on that dude.Read the link which i have mentioned.you would get a basic idea, then debug ur application and find out where does it panic.
    Search the forum with that panic code or post it out there.you would be helped by some one for sure.
    Bst Regrdz
    Priju

  8. #8
    Registered User
    Join Date
    Oct 2006
    Posts
    5

    Re: the problem this listbox with images

    I read that article.
    "Since SDK v1.2, the S60 emulator has only displayed "Program Closed" when an application panics." But when I start the app, the emulator doesn't display "Program Closed". The Emulator closes itself. And the ErrRd stay empty.

Similar Threads

  1. Scrollbar problem in Listbox.
    By mahavirjain in forum Symbian User Interface
    Replies: 0
    Last Post: 2006-06-27, 11:30
  2. ListBox Problem
    By ctrl-d in forum Symbian
    Replies: 4
    Last Post: 2006-06-16, 12:50
  3. Problem with images in TABs
    By larsoveclaesson in forum Symbian User Interface
    Replies: 0
    Last Post: 2005-07-19, 19:15
  4. listbox problem
    By miranda2112 in forum Symbian
    Replies: 2
    Last Post: 2005-07-15, 02:38
  5. listbox in multi view / tab problem
    By jmprince80 in forum Symbian User Interface
    Replies: 1
    Last Post: 2005-06-17, 19:41

Posting Permissions

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