Discussion Board

Results 1 to 4 of 4
  1. #1
    Regular Contributor jensesaat's Avatar
    Join Date
    May 2006
    Location
    Oldenburg/Germany
    Posts
    89
    Hi, i'm a beginner with SymbianOS-Programming and need some help. i only want to know why this applications doesn't work. Thanks for your help and your advices.


    This is my Header-File
    /*
    ============================================================================
    Name : SymbianAppContainer.h
    Author : Jens Saathoff
    Copyright : JS 2006
    Description : Declares container control for application.
    ============================================================================
    */

    #ifndef SYMBIANAPPCONTAINER_H
    #define SYMBIANAPPCONTAINER_H

    // INCLUDES
    #include <coecntrl.h>

    // FORWARD DECLARATIONS
    class CEikLabel; // for example labels
    class CEikEdwin;

    // CLASS DECLARATION

    /**
    * CSymbianAppContainer container control class.
    *
    */
    class CSymbianAppContainer : public CCoeControl, MCoeControlObserver
    {
    public: // Constructors and destructor

    /**
    * EPOC default constructor.
    * @param aRect Frame rectangle for container.
    */
    void ConstructL(const TRect& aRect);

    /**
    * Destructor.
    */
    ~CSymbianAppContainer();

    public: // New functions

    public: // Functions from base classes

    private: // Functions from base classes

    /**
    * From CoeControl,SizeChanged.
    */
    void SizeChanged();

    /**
    * From CoeControl,CountComponentControls.
    */
    TInt CountComponentControls() const;

    /**
    * From CCoeControl,ComponentControl.
    */
    CCoeControl* ComponentControl(TInt aIndex) const;

    /**
    * From CCoeControl,Draw.
    */
    void Draw(const TRect& aRect) const;


    /**
    * From MCoeControlObserver
    * Acts upon changes in the hosted control's state.
    *
    * @param aControl The control changing its state
    * @param aEventType The type of control event
    */
    void HandleControlEventL(CCoeControl* aControl,TCoeEvent aEventType);

    private: //data

    CEikLabel* iLabel; // example label
    CEikLabel* iToDoLabel; // example label
    CEikEdwin* iInput;


    };

    #endif // SYMBIANAPPCONTAINER_H


    This my Implementation.(CPP)

    /*
    ============================================================================
    Name : SymbianAppContainer.cpp
    Author : Jens Saathoff
    Copyright : JS 2006
    Description : Container control implementation
    ============================================================================
    */

    // INCLUDE FILES
    #include "SymbianAppContainer.h"

    #include <eiklabel.h> // for example label control
    #include <eikedwin.h>


    // ================= MEMBER FUNCTIONS =======================

    // ---------------------------------------------------------
    // CSymbianAppContainer::ConstructL(const TRect& aRect)
    // EPOC two phased constructor
    // ---------------------------------------------------------
    //
    void CSymbianAppContainer::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") );

    iInput = new (ELeave) CEikEdwin;
    iInput->SetContainerWindowL(* this);
    // iInput->SetExtent(TPoint(10,40), iInput->MinimumSize());
    //iInput->DrawNow();

    SetRect(aRect);
    ActivateL();
    }

    // Destructor
    CSymbianAppContainer::~CSymbianAppContainer()
    {
    delete iLabel;
    delete iToDoLabel;
    delete iInput;
    }

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

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

    // ---------------------------------------------------------
    // CSymbianAppContainer::ComponentControl(TInt aIndex) const
    // ---------------------------------------------------------
    //
    CCoeControl* CSymbianAppContainer::ComponentControl(TInt aIndex) const
    {
    switch ( aIndex )
    {
    case 0:
    return iLabel;
    case 1:
    return iToDoLabel;
    default:
    return NULL;
    }
    }

    // ---------------------------------------------------------
    // CSymbianAppContainer:raw(const TRect& aRect) const
    // ---------------------------------------------------------
    //
    void CSymbianAppContainer: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 );
    }

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



    the debug-run starts, if i click on my program icon , my program simply stops with an error: "program closed".

    that's all.

    sorry for this stupid question, i will get my symbian book this week.

    Thank you

  2. #2
    Nokia Developer Moderator wizard_hu_'s Avatar
    Join Date
    Feb 2006
    Location
    Mallorca, Holiday
    Posts
    27,683
    You have forgotten to ConstructL the editor control. Since its documentation is missing from S60 SDK-s, refer to http://www.symbian.com/developer/tec...CEikEdwin.html
    You might also want to check "editor" example in the SDK, especially aknexeditorcontainer30 and 33.cpp.
    If you would like to actually see the control, do not forget to include it in the ComponentControl method, and increase the number in CountComponentControls.

  3. #3
    Regular Contributor jensesaat's Avatar
    Join Date
    May 2006
    Location
    Oldenburg/Germany
    Posts
    89
    ok, thank you. now the edwin appears, but i can't get the focus. i can't add no text. thnx

  4. #4
    Nokia Developer Moderator wizard_hu_'s Avatar
    Join Date
    Feb 2006
    Location
    Mallorca, Holiday
    Posts
    27,683
    You need to "bridge" keypresses in your control: implement an OfferKeyEventL method (check SDK help for syntax), with a simple
    Code:
    return iInput->OfferKeyEventL(...);
    as a first try.
    Also make sure that the AppUi contains an AddToStackL after creating your control (although as I remember, the appwizard does so).

Similar Threads

  1. Embedding python in an app
    By varunc in forum Python
    Replies: 1
    Last Post: 2005-12-03, 07:01
  2. upload J2ME app onto Java phones
    By mzichao in forum Mobile Java General
    Replies: 1
    Last Post: 2005-01-11, 07:11
  3. Replies: 3
    Last Post: 2004-12-09, 09:00
  4. Call external Camera app
    By ritec31 in forum Symbian C++
    Replies: 0
    Last Post: 2004-11-19, 16:39
  5. Err - App Main closed
    By Asheesh in forum Symbian C++
    Replies: 1
    Last Post: 2004-10-19, 04:09

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