×

Discussion Board

Results 1 to 3 of 3
  1. #1
    Registered User
    Join Date
    Apr 2006
    Location
    Netherlands
    Posts
    11

    Listbox with findbox, overlapping?

    Hi, I've got a listbox with 14 lines and a findbox. But the findbox overlays the listbox and is also on the top side of the screen and it has to be on the bottom.

    How can I change this?

    Click here to download sis file for example

    ConstructL
    Code:
    void CContactenContainer::ConstructL(const TRect& aRect) {
    	CreateWindowL();
    	SetRect(aRect);
    	CreateListBox();
    	CreateFindBox();
    	ActivateL();
    }
    CreateListBox
    Code:
    void CContactenContainer::CreateListBox()
    {
    	iListBox = new (ELeave) CAknSingleStyleListBox();
    	iListBox->SetContainerWindowL(*this);
    
    	TResourceReader rr;
    	iCoeEnv->CreateResourceReaderLC(rr, R_DEMO_LISTBOX);
    	iListBox->ConstructFromResourceL(rr); 
    	CleanupStack::PopAndDestroy();
    
    	iListBox->CreateScrollBarFrameL(ETrue);
    	iListBox->ScrollBarFrame()->SetScrollBarVisibilityL( CEikScrollBarFrame::EOn, CEikScrollBarFrame::EAuto );
    
    }
    CreateFindBox
    Code:
    void CContactenContainer::CreateFindBox()
    {
    	CAknFilteredTextListBoxModel* model = static_cast<CAknFilteredTextListBoxModel*>(iListBox->Model());
    	iFindBox = CAknSearchField::NewL(*this, CAknSearchField::ESearch, NULL, 10);
    	CleanupStack::PushL(iFindBox);
    	iListBox->SetContainerWindowL(*this);
    	model->CreateFilterL(iListBox, iFindBox);
    	CleanupStack::Pop(iFindBox);
    
    	iFindBox->ActivateL();
    	iFindBox->DrawNow();
    	SizeChanged();
    }
    OfferKeyEventL
    Code:
    TKeyResponse CContactenContainer::OfferKeyEventL(const TKeyEvent& aKeyEvent, TEventCode aType )
    {
    	if(iListBox) {
    		if(iFindBox) {
    			AknFind::HandlePopupFindSizeChanged(this, iListBox, iFindBox);
    			iListBox->SetCurrentItemIndex(0);
    			iListBox->HandleItemAdditionL();
    			SizeChanged();
    			DrawNow();
    		}
    		return iListBox->OfferKeyEventL( aKeyEvent, aType );
    	}
    	else
    		return EKeyWasNotConsumed;
    }
    If you could help me that would be very great.
    Last edited by JSpike; 2006-04-06 at 20:56.

  2. #2
    Regular Contributor
    Join Date
    Aug 2005
    Posts
    79

    Re: Listbox with findbox, overlapping?

    you should also implement SizeChanged function. Something like this should help

    Code:
    // ---------------------------------------------------------
    // CContactenContainer::SizeChanged()
    // Called by framework when the view size is changed
    // ---------------------------------------------------------
    //
    void CContactenContainer::SizeChanged()
        {
        if (iFindBox)
            {
            AknFind::HandlePopupFindSizeChanged(this, iListBox, iFindBox);
            }
          
        TRect rect = Rect();
        
        if (iListBox)
            {
            if (iFindBox)
                {
                rect.Resize(0, -30);
                }
            else
                {
                rect.Resize(0, 0);
                }
            
            rect.Move(0, 0);
            iListBox->SetRect(rect);
            }
           
        if (iFindBox) 
            {
            TRect rectFind = Rect();
            rectFind.SetHeight(10);
            rectFind.Move(0, rect.Height());
            iFindBox->SetRect(rectFind);
            iFindBox->MakeVisible(ETrue);
            iFindBox->SetFocus(ETrue);
            }
        }

  3. #3
    Registered User
    Join Date
    Apr 2006
    Location
    Netherlands
    Posts
    11

    Re: Listbox with findbox, overlapping?

    Thank you! This is what I ment, perfect.

Similar Threads

  1. Replies: 2
    Last Post: 2007-04-17, 14:59
  2. Replies: 2
    Last Post: 2007-04-05, 06:22
  3. how to use listbox with findbox
    By billqu in forum Symbian
    Replies: 2
    Last Post: 2005-01-10, 03:45
  4. Active object and ListBox&#180;s FindBox
    By j1978 in forum Symbian
    Replies: 4
    Last Post: 2003-12-05, 07:27

Posting Permissions

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