×

Discussion Board

Results 1 to 5 of 5
  1. #1
    Registered User
    Join Date
    Apr 2012
    Posts
    39

    Cool It is so strange for ListBox do not show custom item text "123456"

    Hi,

    It is so strange, the 2nd item text ("123456") do not display as expected:

    Code:
    void CTestAppContainer::InitializeControlsL()
    	{
    	iListBox = new ( ELeave ) CAknSingleStyleListBox;
    	iListBox->SetContainerWindowL( *this );
    		{
    		TResourceReader reader;
    		iEikonEnv->CreateResourceReaderLC( reader, R_SIPNET_CONTAINER_LIST_BOX );
    		iListBox->ConstructFromResourceL( reader );
    		CleanupStack::PopAndDestroy(); // reader internal state
    		}
    	// the listbox owns the items in the list and will free them
    	iListBox->Model()->SetOwnershipType( ELbmOwnsItemArray );
    	
    	// setup the icon array so graphics-style boxes work
    	SetupListBoxIconsL();
    	
    	
    	// add list items
    	AddListBoxResourceArrayItemL( R_SIPNET_CONTAINER_LISTBOX_ITEM1_1 );
    	
    	AddListBoxItemL( iListBox, _L("123456") );
    
    	AddListBoxResourceArrayItemL( R_SIPNET_CONTAINER_LISTBOX_ITEM1_2 );
    	
    	iListBox->SetFocus( ETrue );
    	iFocusControl = iListBox;
    	
    	}
    // ]]] end generated function
    Running the above code in phone, it show 3 items, (the 2nd item's text shows as blank)

    Item 1

    Item 2

    It should show as below, but it doesn't !!

    Item 1
    123456
    Item 2

    Code:
    /**
     *	Add a list box item to a list.
     */
    void CTestAppContainer::AddListBoxItemL( 
    		CEikTextListBox* aListBox,
    		const TDesC& aString )
    	{
    	CTextListBoxModel* model = aListBox->Model();
    	CDesCArray* itemArray = static_cast< CDesCArray* > ( model->ItemTextArray() );
    	itemArray->AppendL( aString );
    	aListBox->HandleItemAdditionL();
    	}
    Code:
    // [[[ begin generated function: do not modify
    /**
     *	Add an item to the list by reading the text items from the array resource
     *	and setting a single image property (if available) from an index
     *	in the list box's icon array.
     *	@param aResourceId id of an ARRAY resource containing the textual
     *	items in the columns
     *	
     */
    void CTestAppContainer::AddListBoxResourceArrayItemL( TInt aResourceId )
    	{
    	CDesCArray* array = iCoeEnv->ReadDesCArrayResourceL( aResourceId );
    	CleanupStack::PushL( array );
    	// This is intended to be large enough, but if you get 
    	// a USER 11 panic, consider reducing string sizes.
    	TBuf<512> listString; 
    	CreateListBoxItemL( listString, ( *array ) [ 0 ] );
    	AddListBoxItemL( iListBox, listString );
    	CleanupStack::PopAndDestroy( array );
    	} 
    				
    // ]]] end generated function
    Please help, I have spent a lot of time on this, but found no solution of it.
    Last edited by fnnokia; 2012-05-07 at 11:07.

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

    Re: It is so strange for ListBox do not show custom item text "123456"

    What about checked what happens inside AddListBoxItemL, and whether you are formatting the item line correctly. Also do check the API docs (or header file) for the correct formatting for the selected listbox you are using.

    For a hint, you could maybe check R_SIPNET_CONTAINER_LISTBOX_ITEM1_2 and see what kind of column format it is using, note also that tab \t is used there for column separator

  3. #3
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,693

    Re: It is so strange for ListBox do not show custom item text "123456"

    Try
    Code:
    AddListBoxItemL( iListBox, _L("\t123456") );
    See http://library.developer.nokia.com/i...ists_API3.html for details. You may have to open the link twice in order to get to the real page.

  4. #4
    Registered User
    Join Date
    Apr 2012
    Posts
    39

    Re: It is so strange for ListBox do not show custom item text "123456"

    Quote Originally Posted by symbianyucca View Post
    What about checked what happens inside AddListBoxItemL, and whether you are formatting the item line correctly. Also do check the API docs (or header file) for the correct formatting for the selected listbox you are using.

    For a hint, you could maybe check R_SIPNET_CONTAINER_LISTBOX_ITEM1_2 and see what kind of column format it is using, note also that tab \t is used there for column separator
    Thank you so much,

    Now works with the following code :

    Code:
    	// add list items
    	AddListBoxResourceArrayItemL( R_SIPNET_CONTAINER_LISTBOX_ITEM1_2 );
    	
    	AddListBoxItemL( iListBox, _L("\t123456"));
    	AddListBoxResourceArrayItemL( R_SIPNET_CONTAINER_LISTBOX_ITEM1_2 );
    Added "\t" before the custom text.

  5. #5
    Registered User
    Join Date
    Apr 2012
    Posts
    39

    Re: It is so strange for ListBox do not show custom item text "123456"

    Quote Originally Posted by wizard_hu_ View Post
    Try
    Code:
    AddListBoxItemL( iListBox, _L("\t123456") );
    See http://library.developer.nokia.com/i...ists_API3.html for details. You may have to open the link twice in order to get to the real page.
    Thank you for your useful link !!

Similar Threads

  1. custom "Setting Item List" scenario
    By TAHIR in forum Symbian User Interface
    Replies: 3
    Last Post: 2010-03-29, 05:07
  2. about "Show open apps" menu item in FP2.
    By zdsnet163@163.com in forum Symbian
    Replies: 7
    Last Post: 2009-12-15, 06:06
  3. How to modify the control pane label "OK" and "Cancel" of Text Setting item
    By misfit.physics in forum Symbian User Interface
    Replies: 5
    Last Post: 2007-02-27, 05:39
  4. SECRETED Dialog Item cannot show "***"
    By hmleung in forum Symbian User Interface
    Replies: 4
    Last Post: 2006-11-04, 08:10

Posting Permissions

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