Discussion Board

Results 1 to 8 of 8

Thread: ListBox cropped

  1. #1
    Regular Contributor
    Join Date
    Oct 2008
    Posts
    91

    ListBox cropped

    Hello All,

    I have created a simple listbox . But I am not getting a proper view. The listbox items are getting cropped from below.

    Below is the code.

    #define KGranularityOfArray 10

    void CContactsBackupContainer::CreateListBoxL(const TRect& aRect)
    {

    // listbox instance
    iListBox = new (ELeave) CAknSingleStyleListBox();
    iListBox->ConstructL(this);
    iListBox->SetContainerWindowL(*this);

    // add scrollbars to listbox
    iListBox->CreateScrollBarFrameL(ETrue);
    iListBox->ScrollBarFrame()->SetScrollBarVisibilityL(
    CEikScrollBarFrame::EOn, CEikScrollBarFrame::EAuto );

    const TPoint aPoint(10,10);

    /*TInt aWidth = aRect.Width() ;
    TInt aHeight = aRect.Height();
    const TSize aSize(aWidth ,aHeight);*/

    const TSize aSize(50,150);

    //const TSize aSize = aRect.Size();


    iListBox->SetExtent(aPoint,aSize);

    //Fill list box with the data
    iItemList = new (ELeave) CDesCArrayFlat(KGranularityOfArray);

    GetContactsInfo();

    iListBox->Model()->SetItemTextArray(iItemList);
    iListBox->Model()->SetOwnershipType(ELbmOwnsItemArray);

    iListBox->SetCurrentItemIndex(0);
    iListBox->SetFocus(ETrue);
    iListBox->HandleItemAdditionL();

    iListBox->ActivateL();
    iListBox->DrawNow();
    }

    Also If I display any Information note it does not get cleared completely.

    Please help me...
    Last edited by ash_leo; 2008-11-18 at 10:13.

  2. #2
    Registered User
    Join Date
    Feb 2007
    Location
    Tampere
    Posts
    370

    Re: ListBox cropped

    What happens when you use aRect?

    The problem I think is related to SetExtent(aPoint,aSize), wherein your size is small compared to the whole Screen.

    If you want to use Rect size of device, use CCoeControl::Rect()
    Regards

    - MVP
    "Dare To Dream" - A.P.J.Kalam

  3. #3
    Registered User
    Join Date
    Apr 2005
    Location
    Pune
    Posts
    115

    Re: ListBox cropped

    I am also facing a similar problem. I do not get to see the last item on the screen (I mean, there is enough space left to display 1 more item before you need to scroll). How do I fix it?

    Thanks,
    Shivam

  4. #4
    Registered User
    Join Date
    Feb 2007
    Location
    Tampere
    Posts
    370

    Re: ListBox cropped

    I think it could be related to scrolling enabled disabled for the list box.

    If your list box grows out of bounds, enable scrolling, so that you can scroll down to last item.

    Also check if you are giving a valid(useable) rect.
    Regards

    - MVP
    "Dare To Dream" - A.P.J.Kalam

  5. #5
    Regular Contributor
    Join Date
    Oct 2008
    Posts
    91

    Re: ListBox cropped

    I tried using aRect as well as CCoeControl::Rect(). But then nothing gets displayed at all. I just get to see a plain highlighted item with no text.

  6. #6
    Registered User
    Join Date
    Apr 2005
    Location
    Pune
    Posts
    115

    Re: ListBox cropped

    I have enabled the scrolling and I get to see the scroll pane of right length. But, If there are 10 items in my list and there is enough space to display 6 items,I get to see only top 5 items and I have to scroll using arrow keys to view rest items.Why so??

    Any Help?

  7. #7
    Regular Contributor
    Join Date
    Oct 2008
    Posts
    91

    Re: ListBox cropped

    Hi,
    The problem got solved.
    To add any item to the listbox the following method is used:

    itemList->AppendL(_L("\tFirst item\t\t"));

    I was not using the '\t'.

    Adding the tabs has solved the problem.

  8. #8
    Registered User
    Join Date
    Apr 2005
    Location
    Pune
    Posts
    115

    Re: ListBox cropped

    I was finally able to fix this problem.

    Solution:
    iListBox->SetItemHeightL(ITEM_HEIGHT);
    iListBox->View()->SetItemHeight(ITEM_HEIGHT);

    Thanks,

    SHivam

Similar Threads

  1. problem in ListBox
    By aditighosal in forum Symbian
    Replies: 8
    Last Post: 2008-07-16, 20:01
  2. ListBox Sample.
    By dotice in forum Symbian User Interface
    Replies: 1
    Last Post: 2008-02-26, 14:08
  3. Listbox...
    By harsh_vs in forum Symbian User Interface
    Replies: 2
    Last Post: 2008-02-15, 21:29
  4. Full screen listbox skin not rendered correctly
    By template60 in forum Symbian
    Replies: 2
    Last Post: 2007-09-11, 04:34
  5. Using a "custom" listbox in mobile s60
    By ctpthanh in forum Symbian User Interface
    Replies: 4
    Last Post: 2005-04-17, 14:46

Posting Permissions

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