×

Discussion Board

Results 1 to 3 of 3
  1. #1
    Regular Contributor
    Join Date
    Jul 2004
    Posts
    201

    how to use listbox with findbox

    I code below now; but still error
    The err is in the function SizeChanged(),
    when run the code
    AknFind::HandleFixedFindSizeChanged(this, aknListBox, iFindBox);
    the error is launch.
    I don't know why the line error.
    Please teach me for it.


    in the .h file
    CEikColumnListBox * iListBox;
    CAknSearchField* iFindBox;

    void CLookupContainer::ConstructL(const TRect& aRect)

    {
    CreateWindowL();


    iListBox = new( ELeave ) CAknSingleStyleListBox();

    iTextArray = new (ELeave) CDesCArrayFlat(4);

    CAknSearchField::TSearchFieldStyle style(CAknSearchField::ESearch);

    if ( iListBox )
    {
    // Constructs listbox.
    iListBox->ConstructL( this, 0 );

    // Cache the names and numbers of all contacts
    InitFromContactsDbL();

    iListBox->Model()->SetItemTextArray( iTextArray );
    iListBox->Model()->SetOwnershipType( ELbmDoesNotOwnItemArray );

    }

    iFindBox = CreateFindBoxL(iListBox, iListBox->Model(), style);

    if ( iFindBox)
    {

    iFindBox->MakeVisible( EFalse );

    }


    SizeChanged();

    SetRect(aRect);
    ActivateL();
    }
    void CLookupContainer::SizeChanged()
    {
    // TODO: Add here control resize code etc.
    if ( iListBox )
    {
    if ( iListBox && iFindBox)
    {

    CAknColumnListBox* aknListBox = STATIC_CAST(CAknColumnListBox*, iListBox);
    AknFind::HandleFixedFindSizeChanged(this, aknListBox, iFindBox);
    }
    else
    {
    iListBox->SetRect( Rect() ); // Sets rectangle of lstbox.
    }
    }

    }

    CAknSearchField* CLookupContainer::CreateFindBoxL(
    CEikListBox* aListBox,
    CTextListBoxModel* aModel,
    CAknSearchField::TSearchFieldStyle aStyle )
    {
    CAknSearchField* findbox = NULL;

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

    return findbox;
    }

  2. #2
    Nokia Developer Moderator
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,165
    what does the error note show ?

    Also see this before answering the question : http://www.newlc.com/article.php3?id_article=150

    Also have you checked the listbox example available from SDK, maybe you could see it and check if you code has some differencies between the implementations.

    yucca

  3. #3
    Regular Contributor
    Join Date
    Jul 2004
    Posts
    201

    Can you review my codes

    hello yucca
    I have research the sdk example listbox.
    But I don't find the reason.
    I am so worry.
    Can you help me to find the reason.
    I can send my codes to you.
    Maybe you can find the reason easily.
    My email is billqu@263.net.
    Can you send me a email, I will send my codes to you.
    Waiting for your email.
    Thank you very much.

Posting Permissions

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