×

Discussion Board

Results 1 to 3 of 3
  1. #1
    Registered User
    Join Date
    Nov 2006
    Posts
    12

    Panic Program closed

    hi all
    I am making a simple Application of a lsitbox without using a resource file
    in series60_2nd_fp2 edition using series60 Application wizard and vc6.
    it compile and build successfully but as open the exe give panic Program closed here i am given the code of container.cpp file.

    void CListBox1Container::ConstructL(const TRect& aRect)
    {
    CreateWindowL();

    iLabel = new (ELeave) CEikLabel;
    iLabel->SetContainerWindowL( *this );
    iLabel->SetTextL( _L("Example View") );

    iToDoLabel = new (ELeave) CEikLabel;
    iToDoLabel->SetContainerWindowL( *this );
    iToDoLabel->SetTextL( _L("Add Your controls\n here") );
    CreateListL();
    SetRect(aRect);
    ActivateL();
    }

    void CListBox1Container ::CreateListL ()
    {

    _LIT(KListItemFormat,"%d\t%s\t\t");//listbox item format string
    iListBox1=new(ELeave)CAknSingleNumberStyleListBox;//listbox instance
    iListBox1->ConstructL(this);//construct listbox
    iListBox1->SetContainerWindowL(*this);//set conatiner control
    // iListBox1->CreateScrollBarFrameL(ETrue);//Creating scroll bar
    // iListBox1->ScrollBarFrameL()->SetScrollBarVisibilityL
    // (CEikScrollBarFrame::EOn,CEikScrollBarFrame::EAuto);

    //Construct ListBox Array


    CDesCArray *itemList=new(ELeave)CDesCArrayFlat(3);//create array
    TBuf<32>item; //take buffer
    TInt idx=1;

    item.Format(KListItemFormat,idx,_L("First Item"));//appending item to the list box
    itemList->AppendL(item);
    idx++;
    itemList = static_cast<CDesCArray*>( iListBox1->Model()->ItemTextArray() );


    item.Format(KListItemFormat,idx,_L("Second Item"));//appending Second item to the list box
    itemList->AppendL(item);
    idx++;

    item.Format(KListItemFormat,idx,_L("Last Item"));//appending Last item to the list box
    itemList->AppendL(item);
    idx++;
    CleanupStack::PopAndDestroy();//stack clean
    iListBox1->Model()->SetItemTextArray(itemList);//set Item
    iListBox1->Model()->SetOwnershipType(ELbmOwnsItemArray);


    iListBox1->HandleItemAdditionL();//updatelistbox
    // LoadListL();

    iListBox1->MakeVisible(ETrue);
    // iListBox1->SetRect(aRect);
    iListBox1->ActivateL();
    // iItemList->ListBox()->UpdateScrollBarsL();
    iListBox1->DrawNow();



    }
    // Destructor
    CListBox1Container::~CListBox1Container()
    {
    delete iLabel;
    delete iToDoLabel;
    delete iListBox1;
    }

    // ---------------------------------------------------------
    // CListBox1Container::SizeChanged()
    // Called by framework when the view size is changed
    // ---------------------------------------------------------
    //
    void CListBox1Container::SizeChanged()
    {
    // TODO: Add here control resize code etc.
    iLabel->SetExtent( TPoint(10,10), iLabel->MinimumSize() );
    iToDoLabel->SetExtent( TPoint(10,100), iToDoLabel->MinimumSize() );
    iListBox1 ->SetExtent( TPoint(10,10), TSize(200,200));
    }

    // ---------------------------------------------------------
    // CListBox1Container::CountComponentControls() const
    // ---------------------------------------------------------
    //
    TInt CListBox1Container::CountComponentControls() const
    {
    return 3; // return nbr of controls inside this container
    }

    // ---------------------------------------------------------
    // CListBox1Container::ComponentControl(TInt aIndex) const
    // ---------------------------------------------------------
    //
    CCoeControl* CListBox1Container::ComponentControl(TInt aIndex) const
    {
    switch ( aIndex )
    {
    case 0:
    return iLabel;
    case 1:
    return iToDoLabel;
    case 2:
    return iListBox1;

    default:
    return NULL;
    }
    }

    // ---------------------------------------------------------
    // CListBox1Container:raw(const TRect& aRect) const
    // ---------------------------------------------------------
    //
    void CListBox1Container:raw(const TRect& aRect) const
    {
    CWindowGc& gc = SystemGc();
    // TODO: Add your drawing code here
    // example code...
    gc.SetPenStyle( CGraphicsContext::ENullPen );
    gc.SetBrushColor( KRgbGray );
    gc.SetBrushStyle( CGraphicsContext::ESolidBrush );
    gc.DrawRect( aRect );
    }

    // ---------------------------------------------------------
    // CListBox1Container::HandleControlEventL(
    // CCoeControl* aControl,TCoeEvent aEventType)
    // ---------------------------------------------------------
    //
    void CListBox1Container::HandleControlEventL(
    CCoeControl* /*aControl*/,TCoeEvent /*aEventType*/)
    {
    // TODO: Add your control event handler code here
    }


  2. #2
    Super Contributor
    Join Date
    Jul 2006
    Location
    Oulu, Finland.
    Posts
    1,174

    Re: Panic Program closed

    hi,


    Have you tried to debug your application, what is the error code.


    Regards,
    vasant.

  3. #3
    Nokia Developer Champion
    Join Date
    Mar 2006
    Location
    Helsinki, Finland
    Posts
    8,344

    Smile Re: Panic Program closed

    Hi,
    Quote Originally Posted by anand.tripathi
    hi all
    I am making a simple Application of a lsitbox without using a resource file
    in series60_2nd_fp2 edition using series60 Application wizard and vc6.
    it compile and build successfully but as open the exe give panic Program closed here i am given the code of container.cpp file.
    As vasant said: Debug your code.
    Give the Panic code and the line which causes the panic.
    So that it would be easy to solve your problem.

    Anyways You can find information on How to Display Panic Code from the following link:
    http://newlc.com/Display-the-extende...c-code-in.html

    And moreover Post your problems in the appropriate category of the forum.
    You may get quick reply. I wish.

    Regards.
    Kiran.

Similar Threads

  1. Program Closed ServerSocket
    By nmnir in forum Symbian
    Replies: 10
    Last Post: 2006-05-16, 13:23
  2. Replies: 14
    Last Post: 2006-04-24, 14:03
  3. program closed Browser!!!!!
    By call2kk in forum Symbian
    Replies: 0
    Last Post: 2005-04-20, 12:20
  4. Program Closed: SocketServer on S60 2nd Ed. FP2 Beta emulator
    By jim_st in forum Symbian Tools & SDKs
    Replies: 0
    Last Post: 2004-10-27, 01:58

Posting Permissions

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