×

Discussion Board

Page 1 of 2 12 LastLast
Results 1 to 15 of 17
  1. #1
    Registered User
    Join Date
    Oct 2006
    Posts
    4

    Problem with ListBox

    Hello,
    I need dynamic ListBox. This is my test code (I am trying just build List with one item "Item 1"):

    TBuf<32> iText;
    CAknTextSettingItem* item;
    CAknSettingItemList* iList;
    iList = new (ELeave) CAknSettingItemList;
    iList->SetMopParent(this);

    _LIT(KItem1, "Item 1");
    iText = KItem1;

    item = new (ELeave) CAknTextSettingItem(1, iText);
    CleanupStack::PushL(item);
    iList->SettingItemArray()->AppendL(item);
    CleanupStack::Pop(item);

    I can compile it, but then emulator gives error "kern-exec 3", What I do wrong?

    Thanks,
    Victoria

  2. #2
    Regular Contributor
    Join Date
    Mar 2003
    Posts
    179

    Re: Problem with ListBox

    Hi Victoria,

    Can't be certain without knowing where your KERN-EXEC 3 occurred, but it seems most likely that this is happening because you haven't completed construction of the setting item list. new (ELeave) and SetMopParent() are not enough - You will need to also call ConstructL() to complete construction, or better still ConstructFromResourceL().

    Kevin
    www.symsource.com

  3. #3
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Budapest, Hungary
    Posts
    28,572

    Re: Problem with ListBox

    Note that setting lists are not exactly lists, they are more like a special kind of a form, and in practice their API is one of the worst on Symbian.
    For having a simple list, start with some simple text-mode listbox such as CAknDoubleStyleListbox:
    Code:
    void CSampleContainer::ConstructL(const TRect& aRect)
        {
        CreateWindowL();
    
        iListBox = new (ELeave) CAknDoubleStyleListBox;
        iListBox->ConstructL(this, EAknListBoxSelectionList);
        iListBox->SetContainerWindowL(*this);
        iListBox->CreateScrollBarFrameL(ETrue);
        iListBox->ScrollBarFrame()->SetScrollBarVisibilityL( CEikScrollBarFrame::EOff, CEikScrollBarFrame::EAuto);
        FillListBoxL();
    
        SetRect(aRect);
        ActivateL();
        }
    
    CSampleContainer::~CSampleContainer()
        {
        delete iListBox;
        }
    
    void CSampleContainer::SizeChanged()
        {
        iListBox->SetRect(Rect());    
        }
    
    TInt CSampleContainer::CountComponentControls() const
        {
        return 1;
        }
    
    CCoeControl* CSampleContainer::ComponentControl(TInt aIndex) const
        {
        switch ( aIndex )
            {
            case 0:
                return iListBox;
            default:
                return NULL;
            }
        }
    
    void CSampleContainer::FillListBoxL()
    {
        CDesCArray* array = static_cast<CDesCArray*> (iListBox->Model()->ItemTextArray());
        _LIT(KFormat, "\tItem\t%d");
        TBuf<30> string;
    	
        for (int i=1; i<11; i++) {
            string.Format(KFormat, i*100);
            array->AppendL(string);
    	}
        iListBox->HandleItemAdditionL();
    
    }
    
    TKeyResponse CSampleContainer::OfferKeyEventL(const TKeyEvent &aKeyEvent, TEventCode aType)
    {
        return iListBox->OfferKeyEventL(aKeyEvent, aType);
    }
    Where CSampeContainer is a CCoeControl, and iListBox is a CAknDoubleStyleListBox.

  4. #4
    Registered User
    Join Date
    Oct 2006
    Posts
    4

    Re: Problem with ListBox

    Thaks a lot for a wondefull example!

  5. #5
    Regular Contributor
    Join Date
    Jul 2007
    Location
    Bangladesh
    Posts
    65

    Re: Problem with ListBox

    hi,
    i just done as you coded....but still i'm facing application problem....& when i'm going Tools-->Preference......"Cannot start ECMT manager" this warning occuring ...how i can solve this problem ...plz guide me...
    roman

  6. #6
    Regular Contributor
    Join Date
    Jul 2007
    Location
    Bangladesh
    Posts
    65

    Re: Problem with ListBox

    hi,
    i've solved Cannot "start ECMT manager" message showing problem....now i can see the panic code....
    roman

  7. #7
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Budapest, Hungary
    Posts
    28,572

    Re: Problem with ListBox

    And how do your posts relate to the fact that Victoria asked for and got an example almost a year ago?

  8. #8
    Regular Contributor
    Join Date
    Jul 2007
    Location
    Bangladesh
    Posts
    65

    Re: Problem with ListBox

    hu,
    what are you asking about...?...how i've solved "Cannot start ECMT manager" this message showing...?
    roman

  9. #9
    Regular Contributor
    Join Date
    Oct 2007
    Posts
    121

    Re: Problem with ListBox

    hi wizard_hu,

    thanks for the example...
    Initially i was trying with the following code...

    Code:
    	CDesC16Array *itemList = new (ELeave) CDesC16ArrayFlat(1);
             //formating the string 
    //        setting the ItenTextArray property...
    
    
    	iContactListBox->Model()->SetItemTextArray(itemList);
    	iContactListBox->Model()->SetOwnershipType(ELbmOwnsItemArray);
    So is it that there is no need to do the same...
    directly i can get the pointer

    CDesCArray* array = static_cast<CDesCArray*> (iListBox->Model()->ItemTextArray());

    and keep appending to array...
    no need to allocate memory CDesC16Array *itemList ?

    Thanks for you reply...





    Quote Originally Posted by wizard_hu_ View Post
    Code:
    void CSampleContainer::FillListBoxL()
    {
        CDesCArray* array = static_cast<CDesCArray*> (iListBox->Model()->ItemTextArray());
        _LIT(KFormat, "\tItem\t%d");
        TBuf<30> string;
    	
        for (int i=1; i<11; i++) {
            string.Format(KFormat, i*100);
            array->AppendL(string);
    	}
        iListBox->HandleItemAdditionL();
    
    }
    Where CSampeContainer is a CCoeControl, and iListBox is a CAknDoubleStyleListBox.

  10. #10
    Regular Contributor
    Join Date
    Oct 2007
    Posts
    121

    Re: Problem with ListBox

    hi ,
    i tried implemeting the below suggested method..
    however its giving me following error

    EIKCTL 25
    that is

    Index out of range in CColumnListBoxData


    has anyone come across this error ?

  11. #11
    Regular Contributor
    Join Date
    Oct 2007
    Posts
    121

    Re: Problem with ListBox

    hi i solved the below problem ..
    what mistake i was making was using different class of listbox and having different format string..

  12. #12
    Registered User
    Join Date
    Mar 2008
    Posts
    15

    Re: Problem with ListBox

    hi
    i have implemented the code given this thread, its wroking fine in the emulator but when i am opening the application in mobile it gets closed , can anyone tell me what is wrong .

    thx
    vis

  13. #13
    Regular Contributor
    Join Date
    Feb 2006
    Location
    India,Pune
    Posts
    311

    Re: Problem with ListBox

    check the error code :

    See http://www.newlc.com/Symbian-OS-Error-Codes.html

    Regards,
    Parag Purkar

  14. #14
    Registered User
    Join Date
    Mar 2008
    Posts
    15

    Re: Problem with ListBox

    parag I am not getting any errors the application just closes down when trying to open.

    vis

  15. #15
    Regular Contributor
    Join Date
    Feb 2006
    Location
    India,Pune
    Posts
    311

    Re: Problem with ListBox

    Quote Originally Posted by vis_siv View Post
    hi
    i have implemented the code given this thread, its wroking fine in the emulator but when i am opening the application in mobile it gets closed , can anyone tell me what is wrong .

    thx
    vis
    It is working on emulator


    did u checked ur resources ..check ur images any another resource...check ur .pkg file details .. specially .rsg ,.mif,_reg.rsc are properly mensioned and as they are present on the same location

    which device ur using ?

Similar Threads

  1. Replies: 2
    Last Post: 2007-04-05, 06:22
  2. plz help .....listbox problem
    By Kapil Kaushik in forum Symbian
    Replies: 3
    Last Post: 2006-02-23, 13:49
  3. Problem with Multiselection Listbox in DIALOG ( checkbox )
    By vemulakiran in forum Symbian User Interface
    Replies: 0
    Last Post: 2006-01-12, 12:59
  4. listbox problem (series 80)
    By jokerbirot in forum Symbian
    Replies: 3
    Last Post: 2005-02-18, 09:35
  5. Problem with listbox
    By elenabonetti in forum Symbian
    Replies: 1
    Last Post: 2003-02-07, 20:03

Posting Permissions

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