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!
In ContructL():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(); }
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(); }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.Code:void CreadCalendarAppView::UpdateListBoxL() { iListBox->HandleItemAdditionL(); iListBox->SetCurrentItemIndexAndDraw( 0 ); SizeChanged(); DrawNow(); }
Please help me! Thanks!

Reply With Quote

