×

Discussion Board

Results 1 to 6 of 6
  1. #1
    Regular Contributor
    Join Date
    Apr 2005
    Location
    Wellington
    Posts
    80

    Query ~ Listbox | functional but no text

    This is partially related (I think) to my other post (http://discussion.forum.nokia.com/fo....php?t=76943):

    I have a listbox in a Container. I can populate using:

    Code:
    CTextListBoxModel* model = iListBox->model();
    model->SetOwnershipType(ELbmOwnsItemArray);
    CDesCArray* items = STATIC_CAST(CDesCArray*, model->ItemTextArray());
    items->AppendL(_L("\tItem Text Here"));
    And the listbox is functional with the string 'Item Text Here' showing in the listbox. But when I try to populate via this:

    Code:
    CTextListBoxModel* model = iListBox->Model();
    MDesCArray* itemList = ((CAppUi*)(ControlEnv()->AppUi()))->QueryDbL();
    CDesCArray* itemArray = (CDescArray*) itemList;
    model->SetOwnershipType(ElbmOwnsItemArray);
    model->SetItemListTextArray(itemArray);
    iListBox->HandleItemAdditionL();
    The listbox is also functional in that the data has populated the listbox array but no text is shown in the listbox. They are blank but I can still navigate the items in the list (appears as a hover bar in the emulator), I just can't see any visible text.

    Calling the following from the Container shows the data that should be visible on the listbox:

    Code:
    ((CAppUi*)(ControlEnv()->AppUi()))->ShowNoteL(model->Itemtext(iListBox->CurrentItemIndex()));
    Can anyone shed some light on why the listbox populates with the data and is able to navigate the items. But not show any text?

    Thanks for reading this.
    Last edited by series60nubee; 2006-03-23 at 22:40.

  2. #2
    Regular Contributor
    Join Date
    Apr 2005
    Location
    Wellington
    Posts
    80

    Re: Query ~ Listbox | functional but no text

    I added AppendL to the array as follows:

    Code:
    CTextListBoxModel* model = iListBox->Model();
    MDesCArray* itemList = ((CAppUi*)(ControlEnv()->AppUi()))->QueryDbL();
    CDesCArray* itemArray = (CDescArray*) itemList;
    
    itemArray.AppendL(_L("\tTest"));
    
    model->SetOwnershipType(ElbmOwnsItemArray);
    model->SetItemListTextArray(itemArray);
    iListBox->HandleItemAdditionL();
    And the word 'Test' shows up at the bottom of my listbox but every other item is blank (no visible text).

    I'm getting there but I'd really appreciated some assistence.

    Thanks.
    Last edited by series60nubee; 2006-03-23 at 22:39.

  3. #3
    Regular Contributor
    Join Date
    Apr 2005
    Location
    Wellington
    Posts
    80

    Re: Query ~ Listbox | functional but no text

    The post from Neelakantan (http://discussion.forum.nokia.com/fo...hlight=listbox) suggests it maybe something to do with the Array created when the data I am using was extracted from the database. Something I have suspected but after looking over the BookstoreDb example I downloaded from forum.nokia.com it is very similar to how I am doing my stuff (yet the example works and my code doesn't ~ yet).

  4. #4
    Regular Contributor
    Join Date
    Apr 2005
    Location
    Wellington
    Posts
    80

    Re: Query ~ Listbox | functional but no text

    My Dbms stuff related to contructing an array to be used with the listbox:

    Code:
    CDesCArrayFlat* CStorage::QueryDbmsL()
    {
    	TPtrC myItem;
    	TBuf<KItemMaxLength> rowText;
    
    	RDbTable table;
    	TInt err = table.Open(iDb, KMyTable, table.EReadOnly);
    	User::LeaveIfError(err);
    
    	CDesCArrayFlat* resultArray = new (ELeave)CDesC16ArrayFlat(10);
    	CleanupStack::PushL(resultArray);
    
    	table.Reset();
    	CDbColSet* colSet = table.ColSetL();
    	CleanupStack::PushL(colSet);
    
    	for (table.FirstL(); table.AtRow(); table.NextL())
    	{
    		rowText.Zero();
    
    		table.GetL();
    
    		myItem.Set(table.ColDes(colSet->ColNo(KMyCol)));
    		rowText.Append(myItem);
    		resultArray->AppendL(rowText);
    	}
    	CleanupStack::PopAndDestroy(colSet);
    	CleanupStack::Pop(resultArray);
    	table.Close();
    
    	return resultArray;
    }
    This looks fine to me (and it works), but would anyone else like to comment?

    Should I format 'rowText' with "\t%S" or will the listbox be fine with the data as is from the database?

    Thanks
    Last edited by series60nubee; 2006-03-23 at 22:39.

  5. #5
    Nokia Developer Expert
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,143

    Re: Query ~ Listbox | functional but no text

    yep, your problem is most likely that you have not putn the column separators ('\t') there, so it thinks that all stuff goes to the first column, and rest are empty.

    yucca

  6. #6
    Regular Contributor
    Join Date
    Apr 2005
    Location
    Wellington
    Posts
    80

    Re: Query ~ Listbox | functional but no text

    Thank you so much for confirming that Yucca. I added:

    Code:
    _LIT(Ktab, "\t");
    rowText.Append(KTab);
    That only took me 3 days to fiqure out

Similar Threads

  1. Listbox non-selected item text is invisible
    By vasilip in forum Symbian User Interface
    Replies: 2
    Last Post: 2006-08-28, 21:22
  2. Wrapping text in a listbox
    By mark_williams in forum Symbian User Interface
    Replies: 3
    Last Post: 2005-05-31, 14:21
  3. Replies: 0
    Last Post: 2004-11-24, 18:49
  4. Text Query Dialog Cleanup
    By koayst in forum Symbian
    Replies: 1
    Last Post: 2003-05-02, 09:06
  5. Replies: 0
    Last Post: 2003-03-06, 11:43

Posting Permissions

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