Discussion Board

Results 1 to 15 of 15
  1. #1
    Regular Contributor ashish_apj's Avatar
    Join Date
    Apr 2005
    Location
    INDIA
    Posts
    52
    Hi,

    I want to create a list box in my application. My code is as below:-I have defined the resouce in .rss file as below:-

    RESOURCE LISTBOX r_listbox_timer
    {
    flags = EAknListBoxSelectionList | EAknListBoxViewerFlags;
    array_id = r_listbox_timer_items;
    }

    RESOURCE ARRAY r_listbox_timer_items
    {
    items =
    {
    LBUF { txt = "Item1"; },
    LBUF { txt = "Item2"; },
    LBUF { txt = "Item3"; }
    };
    }

    In View Class, i want to create the list box from resource file as below:-

    void CtimerAppView::ConstructL( const TRect& aRect )
    {
    // Create a window for this application view
    CreateWindowL();

    //Ashsih list Box Addition:-starts
    iListBox = new (ELeave) CAknSingleStyleListBox();

    // construct listbox
    iListBox->ConstructL(this);

    // set container control
    iListBox->SetContainerWindowL(*this);

    // initialize resource reader, passing resource id as parameter
    TResourceReader reader;
    TInt resource_id= R_LISTBOX_TIMER; //r_demo_listbox_viewer/*R_DEMO_LISTBOX_VIEWER*/

    iEikonEnv->CreateResourceReaderLC(reader,resource_id);

    // load and construct the resource

    iListBox->ConstructFromResourceL(reader);
    CleanupStack::PopAndDestroy(); // rr

    //Ashish ListBox Edition Ends

    // Set the windows size
    SetRect( aRect );

    // Activate the window, which makes it ready to be drawn
    ActivateL();

    }


    Compilation is okay, but wheni run my application, it crashes "App. Closed"

    Can somebody help me out in resolving the problem...
    Last edited by ashish_apj; 2007-05-09 at 06:21.

  2. #2
    Nokia Developer Expert symbianyucca's Avatar
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    28,712
    Could you try running it in the emulator, basically if you put a break point at the start of the code and run it line-by-line you could get the actual line causing the crash.

    Also you could try using TRAPs to trap the error code. Then put more information here and maybe somebody could figure out what is causing the crash.

    yucca

  3. #3
    Super Contributor Priju Jacob Paul's Avatar
    Join Date
    Oct 2005
    Location
    Hyderabad,India
    Posts
    1,156
    also check the listbox example that comes with the FP2 sdk.that would favour you.

    Priju

  4. #4
    Regular Contributor ashish_apj's Avatar
    Join Date
    Apr 2005
    Location
    INDIA
    Posts
    52
    Hi I have checked the example, and to my surprise all things are same...

    Well i debug the program and found that its crashing in

    iListBox->ConstructFromResourceL()

    I checked other forums as well and they suggested to implement thses functions
    TInt CountComponentControls() const;
    CCoeControl* ComponentControl(TInt aIndex) const;
    but after that also, its crashing at same point, in function iListBox->ConstructFromResourceL()

    Please suggest what to do?

  5. #5
    Super Contributor Priju Jacob Paul's Avatar
    Join Date
    Oct 2005
    Location
    Hyderabad,India
    Posts
    1,156
    What have you got under those functions?
    does it return the iListBox under ComponentControl() and 1 under the function CountComponentControls() if you have only listbox as a control in your container.

    Please post those functions out here.

    Priju

  6. #6
    Regular Contributor ashish_apj's Avatar
    Join Date
    Apr 2005
    Location
    INDIA
    Posts
    52
    Yes, these functions implement exactly what you have mentioned, please find them as under..

    TInt CtimerAppView::CountComponentControls() const
    {
    return 1; // return number of controls inside this container
    }

    CCoeControl* CtimerAppView::ComponentControl(TInt aIndex) const
    {
    switch (aIndex)
    {
    case 0:
    return iListBox;
    default:
    return NULL;
    }
    }

  7. #7
    Super Contributor Priju Jacob Paul's Avatar
    Join Date
    Oct 2005
    Location
    Hyderabad,India
    Posts
    1,156
    Check this links from wiki forum nokia.

    http://wiki.forum.nokia.com/index.ph...simple_listbox

    i would ask you to do these:
    1) check the format of the contents which you are appending onto the listbox array.
    2) Check the error code also. Hope you have enabled the extended panic code and are testing on in the emulator.

    Priju

  8. #8
    Regular Contributor ashish_apj's Avatar
    Join Date
    Apr 2005
    Location
    INDIA
    Posts
    52
    Hi Priju,

    Please tell me how to enable "extended panic code". Meanwhile i go through the link you have menitoned.

    Thanks
    -Ashish

  9. #9
    Super Contributor Priju Jacob Paul's Avatar
    Join Date
    Oct 2005
    Location
    Hyderabad,India
    Posts
    1,156
    Just go thru this link.
    Extended Panic Code.

    Seems like your format of the items are wrong.Check giving it like this.

    LBUF { txt = "\tItem1"; },
    LBUF { txt = "\tItem2"; },
    LBUF { txt = "\tItem3"; }

    Just give a try.

    Priju

  10. #10
    Regular Contributor ashish_apj's Avatar
    Join Date
    Apr 2005
    Location
    INDIA
    Posts
    52
    Hi tried with the modified resource you provided the status is same... Application closes.

    With extended Panic code enabled, I get the message

    App. Closed:
    timer
    AVKON 6

  11. #11
    Super Contributor Priju Jacob Paul's Avatar
    Join Date
    Oct 2005
    Location
    Hyderabad,India
    Posts
    1,156
    Check this link.

    http://discussion.forum.nokia.com/fo...d.php?t=104333

    Are you doing the same mistake quoted in that thread.

    Priju

  12. #12
    Regular Contributor ashish_apj's Avatar
    Join Date
    Apr 2005
    Location
    INDIA
    Posts
    52
    Hi,

    I have tried all, but not able to figure out whats going on....please suggest me wat to do?

  13. #13
    Super Contributor Priju Jacob Paul's Avatar
    Join Date
    Oct 2005
    Location
    Hyderabad,India
    Posts
    1,156
    Hello Ashish,
    I just tried out your code.

    Please make the following changes.

    1)
    in .rss
    Code:
    RESOURCE ARRAY r_listbox_timer_items
    {
    items =
    {
     LBUF { txt = "\tItem1"; },
     LBUF { txt = "\tItem2"; },
     LBUF { txt = "\tItem3"; }
    };
    }
    2) in your ConstructL,
    as you are constructing the listbox from the resource you need not create it dynamically.henceforth comment iListbox->ConstructL().Thats not needed.
    3)
    Add this in your SizeChanged() function.

    Code:
    iListBox->SetExtent(TPoint(0,0), iListBox->MinimumSize() );
    Hope you get it right!

    Priju

  14. #14
    Regular Contributor ashish_apj's Avatar
    Join Date
    Apr 2005
    Location
    INDIA
    Posts
    52
    Thanks Friend,

    Finally, I can see the listbox appearing in my application...

    -Ashish

  15. #15
    Super Contributor Priju Jacob Paul's Avatar
    Join Date
    Oct 2005
    Location
    Hyderabad,India
    Posts
    1,156
    Quote Originally Posted by ashish_apj
    Thanks Friend,

    Finally, I can see the listbox appearing in my application...

    -Ashish
    Good Enough!!!

    Priju

Similar Threads

  1. App. closed Childínstaller ERROR
    By juliusnequia in forum Mobile Java General
    Replies: 2
    Last Post: 2008-06-21, 04:50
  2. symbian signed testing problem.
    By anglina in forum Symbian C++
    Replies: 0
    Last Post: 2007-02-01, 10:15
  3. App not get closed whn ---> press App key n select 'C'
    By saurbh_g in forum Symbian User Interface
    Replies: 5
    Last Post: 2006-05-11, 09:51
  4. Err - App Main closed
    By Asheesh in forum Symbian C++
    Replies: 1
    Last Post: 2004-10-19, 04:09
  5. App Closed !
    By rhim in forum Mobile Java General
    Replies: 1
    Last Post: 2003-05-10, 01:23

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Nokia Developer aims to help you create apps and publish them so you can connect with users around the world.

京ICP备05048969号  © Copyright Nokia 2013 All rights reserved