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;
	
}
CAknSearchField* CSymellaSearchContainer::CreateFindBoxL( 
    CEikListBox* aListBox,
    CTextListBoxModel* aModel,
    CAknSearchField::TSearchFieldStyle aStyle )
{
	CAknSearchField* findbox = NULL;

	if ( aListBox && aModel )
	    {
	    // Gets pointer of CAknFilteredTextListBoxModel.
	    CAknFilteredTextListBoxModel* model =
	            static_cast<CAknFilteredTextListBoxModel*>( aModel );
	    // Creates FindBox.
	    findbox = CAknSearchField::NewL( *this,
	                                     aStyle,
	                                     NULL,
	                                     KListFindBoxTextLength );
	    CleanupStack::PushL( findbox );
	    // Creates CAknListBoxFilterItems class.
	    model->CreateFilterL( aListBox, findbox );
	    //Filter can get by model->Filter();
	    CleanupStack::Pop( findbox ); // findbox
	    }

	return findbox;
}
void MobiStegoContacts::ConstructL(const TRect& aRect,
		CMobiStegoDocument* aDocument)
	{
	iDocument = aDocument;
	CreateWindowL();
	SetRect(aRect);

	/*other 
	 iListBox = new (ELeave) CAknSingleStyleListBox;
	 iListBox->ConstructL(this, EAknListBoxSelectionList );

	 iListBox->Model()->SetItemTextArray(iListBoxRows);
	 iListBox->CreateScrollBarFrameL();
	 iListBox->Model()->SetOwnershipType(ELbmDoesNotOwnItemArray);
	 iListBox->SetListBoxObserver(this);
	 //UpdateL();
	 //	iListBox->HandleItemAdditionL();

	 // set up the Search Field
	 CAknSearchField* findbox = NULL;

	 // Gets pointer of CAknFilteredTextListBoxModel.
	 CAknFilteredTextListBoxModel* model = STATIC_CAST( CAknFilteredTextListBoxModel*, iListBox->Model() );
	 // Creates FindBox.
	 findbox = CAknSearchField::NewL(*this, CAknSearchField::EPopup, NULL,
	 40);
	 CleanupStack::PushL(findbox);
	 // Creates CAknListBoxFilterItems class.
	 model->CreateFilterL(iListBox, findbox);
	 //Filter can get by model->Filter();
	 CleanupStack::Pop(findbox); // findbox

	 SizeChanged();

	 iListBox->ActivateL();

	 TInt ItemsCount = iListBox->Model()->ItemTextArray()->MdcaCount();

	 iListBox->SetCurrentItemIndex(0);

	 //		UpdateScrollBar(iListBox);
	 DrawNow();*/
	/*
	 CAknSearchField* searchField = CAknSearchField::NewL(*this,
	 CAknSearchField::EPopup, 0, 40);
	 CleanupStack::PushL(searchField);
	 CAknFilteredTextListBoxModel* filteredModel =
	 static_cast<CAknFilteredTextListBoxModel*> (iListBox->Model());
	 filteredModel->CreateFilterL(iListBox, searchField);
	 CleanupStack::Pop(searchField);
	 searchField->MakeVisible(ETrue);

	 iListBoxSearchField = searchField;
	 iListBoxSearchField->SetFocus(ETrue);

	 //Set Up the CBA for the searchbox
	 CEikButtonGroupContainer* cba = CEikButtonGroupContainer::Current();
	 cba->SetCommandSetL(R_AVKON_SOFTKEYS_OPTIONS_BACK);
	 TInt posBack = cba->PositionById(EAknSoftkeyBack);
	 cba->SetCommandL(posBack, EContactsViewGoBackCmdNone, KNullDesC);
	 iSpdDialPos = -1;
	 SetRect(aRect);
	 */
	/**/
	// create listbox control
	iListBox = new (ELeave) CAknSingleStyleListBox;
	iListBox->ConstructL(this, 0);
	iListBox->SetContainerWindowL(*this);
	iListBox->SetRect(aRect.Size());

	iListBoxRows = new (ELeave) CDesCArrayFlat(KGranularityOfArray);
	iListBox->Model()->SetItemTextArray(iListBoxRows);
	iListBox->Model()->SetOwnershipType(ELbmDoesNotOwnItemArray);

	iListBox->ActivateL();
	iListBox->CreateScrollBarFrameL(ETrue);
	iListBox->ScrollBarFrame()->SetScrollBarVisibilityL(
			CEikScrollBarFrame::EOn, CEikScrollBarFrame::EAuto);
	//------------------------------------------------------

	searchField = CAknSearchField::NewL(*this,
			CAknSearchField::EPopup, 0, 40);
	CleanupStack::PushL(searchField);
	CAknFilteredTextListBoxModel* filteredModel =
			static_cast<CAknFilteredTextListBoxModel*> (iListBox->Model());
	filteredModel->CreateFilterL(iListBox, searchField);
	CleanupStack::Pop(searchField);
	searchField->MakeVisible(ETrue);
	SizeChanged();
	//-----------------------------------------------------
	ActivateL();
	MakeVisible(ETrue);
	searchField->SetFocus(ETrue);
	}