×

Discussion Board

Results 1 to 5 of 5
  1. #1
    Registered User
    Join Date
    May 2004
    Posts
    24

    Display textboxlist

    Does anyone find any problem with the following code to display simple textlistbox? I am getting a blank display

    iListBox = new (ELeave) CEikTextListBox;
    iListBox->SetContainerWindowL(*this);
    iListBox->ConstructL(this, 0);

    iListBox->SetRect(aRect);

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

    iMessageList = new (ELeave) CDesCArrayFlat(10);
    CTextListBoxModel* model = iListBox->Model();
    model->SetItemTextArray(iMessageList);
    model->SetOwnershipType(ELbmOwnsItemArray);

    iMessageList->AppendL(data); // data is _LIT type
    iListBox->HandleItemAdditionL();

  2. #2
    Nokia Developer Moderator
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,166
    are you creating the window, setting some react & activating the container window ?

    What size is the eRect, what size is the container rect() ?

    Do you return the pointers & control count in right way in the container control ?

    yucca

  3. #3
    Registered User
    Join Date
    May 2004
    Posts
    24
    Thanks yucca. I figured it out. The problem is I am activating before setting up the messagelist. Now I reorganized the code and its working. But I am unable to use down and up arrows to select an item in the list. What do i have to do in order to select an item from the list and catch the event?

  4. #4
    Registered User
    Join Date
    May 2004
    Posts
    24
    Now I am able to select an item from the list, but unable to catch the event in HandleListBoxEventL(). I have followed this link and wrote the following code..

    TKeyResponse CCompoundControl::OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType)
    {
    case EKeyDevice3:
    _LIT(df," dfs ");
    return iListBox->OfferKeyEventL(aKeyEvent, aType);
    break;

    }
    }

    http://discussion.forum.nokia.com/fo...textlistbox%2A

  5. #5
    Nokia Developer Moderator
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,166
    hi

    for keyevents (up, down, ok etc. ) you should use offer keyevent, just use it like this:

    TKeyResponse CCompoundControl::OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType)
    {
    TKeyResponse Ret = EKeyWasNotConsumed;
    switch(aKeyEvent.iCode)
    {
    case EKeyDevice3:
    //Call your function that handles joy-stick middle click here
    break;
    default:
    if(ListBox)
    Ret = iListBox->OfferKeyEventL(aKeyEvent, aType);
    break;
    }

    return Ret;
    }

    if you want to catch the listbox event you'll just implement the
    MEikListBoxObserver (i.e. derive the MEikListBoxObserver in your class and implement the function), then you also need to set the listbox to use your container class as a observer, see SDK docs for more info.

    yucca

Posting Permissions

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