×

Discussion Board

Results 1 to 3 of 3
  1. #1
    Regular Contributor
    Join Date
    May 2007
    Posts
    53

    how to display in ceiktextlistbox?

    Hi,

    I've tried to fetch entries from calendar pim and display it onto a ceiktextlistbox, but yields no result. Hope someone can help me!

    Code:
    void CreadCalendarAppView::FetchEntryL()
    	{
    	
    	TInt count( iCalArray->Count() );
        if ( count )
            {
            // Clear array. Start to index 0
    	    iCalArray->Delete( 0, count );
            }
        
    	CCalIter* calIter = CCalIter::NewL(*iCalSession);
    	CleanupStack::PushL(calIter);
    	TBuf8<50> iterUid;
    	RPointerArray<CCalEntry> calEntryArray;
    	CleanupClosePushL(calEntryArray);
    	iterUid = calIter->FirstL();
    	if (iterUid != KNullDesC8)
    		{
    		iCalEntryView->FetchL(iterUid, calEntryArray);
    		for (TInt i = 0; i<calEntryArray.Count(); i++)
    			{
    			CCalEntry* calEntry = calEntryArray[i];
    			TPtrC description = calEntry->SummaryL();
    			HBufC* des = description.AllocL();
    			
    			iCalArray->AppendL(*des); // is this correct?
    			}
    		iterUid = calIter->NextL();
    		}
    
    	CleanupStack::PopAndDestroy(&calEntryArray);
    	CleanupStack::PopAndDestroy(calIter);
    	
    	UpdateListBoxL();
    	}
    In ContructL():

    Code:
    void CreadCalendarAppView::ConstructL( const TRect& aRect )
    	{
    	
    	iCalArray = new (ELeave) CDesCArrayFlat(4); 
    	
    	// Create a window for this application view
    	CreateWindowL();
    	
    	CreateAndOpenCalendarL();
    	
    	iListBox = new (ELeave) CAknSingleStyleListBox;
    	
        if ( iListBox )
            {
            iListBox->ConstructL( NULL, EAknListBoxSelectionList );
            iListBox->Model()->SetItemTextArray( iCalArray );
            iListBox->CreateScrollBarFrameL();
            iListBox->Model()->SetOwnershipType( ELbmOwnsItemArray );
            iListBox->SetListBoxObserver( this ); // set observer for list box
            iListBox->HandleItemAdditionL(); // handles item addition for list box
            }
        
        SizeChanged(); // list box start from top of main pane, and at least minimum size
    	
    	// Set the windows size
    	SetRect( aRect );
    	
    	// Activate the window, which makes it ready to be drawn
    	ActivateL();
    	}
    Code:
    void CreadCalendarAppView::UpdateListBoxL()
        {
        iListBox->HandleItemAdditionL();
        iListBox->SetCurrentItemIndexAndDraw( 0 );
        SizeChanged();
        DrawNow();
        }
    I could not get the text out, but it seems that the listbox is able to get the number of entries. Just that no text is shown.

    Please help me! Thanks!

  2. #2
    Regular Contributor
    Join Date
    May 2007
    Posts
    463

    Re: how to display in ceiktextlistbox?

    Things I can see that are wrong:

    - You aren't passing it a pointer to its parent control (passing NULL instead)
    - You aren't obeying the documented item format, from the manual "list item string format: "\tTextLabel\t0\t1" where 0 and 1 are indexes to icon array"
    - The memory for all your descriptors is leaked.
    Get Resolvr - The Zeroconf framework for Symbian OS free today. Make your IP networking applications fun and easy to use. http://www.novelinteractions.com/resolvr/
    Proud to be the only autorickshaw owner in Cambridge - http://blog.novelinteractions.com/images/tuktuk.jpg

  3. #3
    Regular Contributor
    Join Date
    May 2007
    Posts
    53

    Re: how to display in ceiktextlistbox?

    Thanks for your reply. Sorry I'm new to this Symbian environment, so I'm really blur about the concept. Hope you can help me out further more...

Similar Threads

  1. Recording in Amr Format
    By losym in forum Symbian Media (Closed)
    Replies: 12
    Last Post: 2009-03-26, 06:41
  2. Nokia N-Series Complete Model Line-Up
    By Dopod in forum General Development Questions
    Replies: 6
    Last Post: 2008-07-22, 20:16
  3. Replies: 2
    Last Post: 2003-08-07, 12:58
  4. Game Developement - Display object on a image background
    By kenkwokkam in forum Mobile Java General
    Replies: 0
    Last Post: 2003-02-08, 14:58
  5. Display question ...
    By kapot in forum Mobile Java General
    Replies: 0
    Last Post: 2002-10-14, 22:09

Posting Permissions

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