コード例 #1
0
void CSearchableListBoxContainer::InitializeControlsL()
{
   iListBox = new ( ELeave ) CAknSingleStyleListBox;
   iListBox->SetContainerWindowL( *this );
   {
      TResourceReader reader;
      iEikonEnv->CreateResourceReaderLC( reader, R_WAYFINDER_SEARCHABLE_LISTBOX );
      iListBox->ConstructFromResourceL( reader );
      CleanupStack::PopAndDestroy(); // reader internal state
   }
   // the listbox owns the items in the list and will free them
   //iListBox->Model()->SetOwnershipType( ELbmOwnsItemArray );
   iListBox->Model()->SetOwnershipType( ELbmDoesNotOwnItemArray );

   // setup the icon array so graphics-style boxes work
   SetupListBoxIconsL();
	
   iListBox->SetListBoxObserver( this );
	
   // set up the Search Field	
   CAknSearchField* searchField = 
      CAknSearchField::NewL( *this, CAknSearchField::ESearch, 0, 40 );
	
   CleanupStack::PushL ( searchField );
   CAknFilteredTextListBoxModel* filteredModel = 
      static_cast< CAknFilteredTextListBoxModel* >( iListBox->Model() );
   filteredModel->CreateFilterL( iListBox, searchField );
   CleanupStack::Pop( searchField );
   searchField->MakeVisible( ETrue );
   iListBoxSearchField = searchField;
	
   iListBox->SetFocus( ETrue );
   iFocusControl = iListBox;
	
}
コード例 #2
0
// ---------------------------------------------------------------------------
// CBCTestMix50Case::TestCAknSearchFieldCaseL()
// ( menu item -2- )
// ---------------------------------------------------------------------------
//
void CBCTestMix50Case::TestCAknSearchFieldCaseL()
    {
    CAknSearchField* search = CAknSearchField::NewL( *iContainer,
                                         CAknSearchField::ESearch,
                                         NULL, KSearchFieldMaxLength );
    CleanupStack::PushL( search );
    _LIT( KTxtNewL, "CAknSearchField::NewL" );
    AssertNotNullL( search, KTxtNewL );

    search->MakeVisible( ETrue );
    search->MakeVisible( EFalse );
    _LIT( KTxtMakeVisible, "CAknSearchField::MakeVisible" );
    AssertTrueL( ETrue, KTxtMakeVisible );

    CleanupStack::PopAndDestroy( search );
    }