×

Discussion Board

Page 1 of 2 12 LastLast
Results 1 to 15 of 24
  1. #1
    Regular Contributor
    Join Date
    Aug 2005
    Posts
    200

    How do I display data?

    HI!

    I am developing my first Symbian application and am referencing "Developing Series 60 Applications" by Leigh Edwards. The example that I am using as a reference is HelloWorld.

    In the section "Header & Source Files", the book outlines the contents & functions of each of the souce files. Following is a brief snapshot:

    - HelloWorldApp.h: Application creation/initialization
    - HelloWorldApp.cpp: Application creation/initialization
    - HelloWorldAppUI.h: Command handler/controller
    - HelloWorldAppUI.cpp: Command handler/controller
    - HelloWorldDocument.h: Owns the data or application model
    - HelloWorldDocument.cpp: Owns the data or application model
    - HelloWorldContainer.h: Displays the application data
    - HelloWorldContainer.cpp: Displays the application data

    It reads that while the '.h' files contain the class & functions declarations, the '.cpp' files contain the class & functions definitions.

    While the HelloWorld example conforms to the above described situation, when I create a new application using the 'Symbian Project Wizard', I am presented with the following set of files in the 'Source' plus-sign tree in the IDE:

    - TestApp.cpp
    - TestApplication.cpp
    - TestAppUI.cpp
    - TestAppView.cpp
    - TestDocument.cpp
    - UID.cpp

    My question is:

    Since I would like to display a 'Welcome' message on the very first screen as the user starts the application, where should I define the equivalent of the following code in the absence of a TestContainer.cpp file:

    HBufC* labelText;
    labelText = StringLoader::LoadLC(R_LABEL_TEXT);
    iLabel->SetTextL(*labelText);
    CleanupStack::PopAndDestroy(labelText);

    Please note that I am using CW v3.1 & SDK 2nd_FP2_CW.

    Thx & cheers,

    wirefree101

  2. #2
    Nokia Developer Moderator
    Join Date
    Sep 2004
    Location
    Tampere, Finland
    Posts
    11,359

    Re: How do I display data?

    Quote Originally Posted by wirefree101
    HI!

    I am developing my first Symbian application and am referencing "Developing Series 60 Applications" by Leigh Edwards. The example that I am using as a reference is HelloWorld.

    In the section "Header & Source Files", the book outlines the contents & functions of each of the souce files. Following is a brief snapshot:

    - HelloWorldApp.h: Application creation/initialization
    - HelloWorldApp.cpp: Application creation/initialization
    - HelloWorldAppUI.h: Command handler/controller
    - HelloWorldAppUI.cpp: Command handler/controller
    - HelloWorldDocument.h: Owns the data or application model
    - HelloWorldDocument.cpp: Owns the data or application model
    - HelloWorldContainer.h: Displays the application data
    - HelloWorldContainer.cpp: Displays the application data

    It reads that while the '.h' files contain the class & functions declarations, the '.cpp' files contain the class & functions definitions.

    While the HelloWorld example conforms to the above described situation, when I create a new application using the 'Symbian Project Wizard', I am presented with the following set of files in the 'Source' plus-sign tree in the IDE:

    - TestApp.cpp
    - TestApplication.cpp
    - TestAppUI.cpp
    - TestAppView.cpp
    - TestDocument.cpp
    - UID.cpp

    My question is:

    Since I would like to display a 'Welcome' message on the very first screen as the user starts the application, where should I define the equivalent of the following code in the absence of a TestContainer.cpp file:

    HBufC* labelText;
    labelText = StringLoader::LoadLC(R_LABEL_TEXT);
    iLabel->SetTextL(*labelText);
    CleanupStack::PopAndDestroy(labelText);

    Please note that I am using CW v3.1 & SDK 2nd_FP2_CW.

    Thx & cheers,

    wirefree101
    The files underlined above are most likely equivalent, they both contain the implementation of a CCoeControl derived class... Your code will have to go in that class' ConstructL method.

    Hm, that book should be explaining all this ... make sure you read the entire chapter before coding an exercise. :)

    Best regards,

  3. #3
    Regular Contributor
    Join Date
    Aug 2005
    Posts
    200

    Re: How do I display data?

    Thx! Found what I was looking for a chapter later in the book.

    I have done a thorough comparison of the following set of files:

    - TestAppView.h vis-a-vis HelloWorldContainer.h
    - TestAppView.cpp vis-a-vis HelloWorldContainer.cpp
    - TestAppUI.cpp vis-a-vis HelloWorldAppUI.cpp
    - Test.rss vis-a-vis HelloWorld.rss


    Following is the step-by-step procedure I undertook:

    o TestAppview.h
     Added ‘class CEikLabel’
     Added SizeChanged()
     Added CountComponentControls()
     Changed draw() from public to private
     Added CEikLabel* iLabel as private data
     Commented out CTestAppView() to conform with HelloWorldContainer.h

    o TestAppview.cpp
     Included eiklabel.h
     Included stringloader.h
     Defined KLabelPosition TPoint
     iLabel related code:
    • iLabel = new (ELeave) CEikLabel;
    • iLabel->SetContainerWindowL(*this);
    • HBufC* labelText;
    • labelText = StringLoader::LoadLC(R_LABEL_TEXT);
    • iLabel->SetTextL(*labelText);
    • CleanupStack::PopAndDestroy(labelText);
     Added ‘delete iLabel’ to the destructor
     Added CTestAppView::SizeChanged()
     Added CTestAppView::CountComponentControls()
     Added CCoeControl* CTestAppView::ComponentControl()
     Commented out CTestAppView:: CTestAppView()
     Commented out TRect rect = Rect() from void CTestAppView::Draw()

    o TestAppUI.cpp
     Included test.rsg
     Included stringloader.h
     Called SetMopParent on AppView
     Commented iAppView = NULL from the destructor
     Commented out CTestAppUI:: CTestAppUI()
     Made necessary changes to HandleComandL to accommodate various commands defined in Test.rss

    o Test.rss
     Included avkon.mbg
     Added RESOURCE TBUF r_label_text {}


    I get one error when I 'make':

    "Error: undefined identifier 'R_LABEL_TEXT'"


    Where do I insert the actual text I want displayed on my 'Welcome Screen'?

    Advise appreciated, as always.


    Thx in advance,
    wirefree101

  4. #4
    Regular Contributor
    Join Date
    Apr 2006
    Location
    Malaysia
    Posts
    246

    Re: How do I display data?

    Hi,

    Have you define R_LABEL_TEXT in .loc file?

    In Text.loc define:
    #define R_LABEL_TEXT "Text"
    Regards,
    Nini

  5. #5
    Nokia Developer Moderator
    Join Date
    Sep 2004
    Location
    Tampere, Finland
    Posts
    11,359

    Re: How do I display data?

    R_LABEL_TEXT is a resource id and should have been generated in test.rsg as a efect of compiling the r_label_text statement from the test.rss file.
    Code:
    RESOURCE TBUF r_label_text
    	{
    	buf = LABEL_TEXT;
    	}
    (I am kind of guesssing the resouce definition since it is missing from your problem description.) It is LABEL_TEXT that should be define in a *.loc file that has to be included in test.rss. Or you may replace that line with a language independent one
    Code:
    buf = "Welcome!";
    Check the %EPOCROOT%epoc32\include\test.rsg file. If it is missing look for resource build errors in the build log and fix them.

    You can also code your welcome message without the use of resources:
    Code:
    iLabel = new (ELeave) CEikLabel;
    iLabel->SetContainerWindowL(*this);
    _LIT(KWelcome, "Welcome!");
    iLabel->SetTextL(KWelcome);
    unless mastering the resources is what you are focusing on right now.

    Best regards,

  6. #6
    Regular Contributor
    Join Date
    Aug 2005
    Posts
    200

    Re: How do I display data?

    Very right about the Test.loc file there...However, the Symbian Project Wizard did not, by default, create a .loc for my test project.

    Therefore, as suggested, I took the alternative route of hard-coding the 'Welcome' message into TestAppView.cpp by incorporating the following code:

    Code:
    iLabel = new (ELeave) CEikLabel;
    iLabel->SetContainerWindowL(*this);
    _LIT(KWelcome, "Welcome!");
    iLabel->SetTextL(KWelcome);
    I have also deleted the Resource TBUF r_label_text definition in Test.rss.

    However, when I build, I get 3 link errors:

    - Link Error : Undefined symbol: 'CwelcomeScreenAppUi::CwelcomeScreenAppUi(void) (??0CwelcomeScreenAppUi@@QAE@XZ)'

    - Link Error : MAKEDEF ERROR: C:\Symbian\8.0a\S60_2nd_FP2_CW\Examples\welcomeScreen\group\welcomeScreen_Data\WINSCW_UDEB\WELCOMESCREEN.inf:
    Inffile not found

    - Link Error : Undefined symbol: 'CwelcomeScreenAppUi::CwelcomeScreenAppUi(void) (??0CwelcomeScreenAppUi@@QAE@XZ)'


    Would greatly appreciate some advise here.

    Best,
    wirefree101

  7. #7
    Super Contributor
    Join Date
    May 2003
    Location
    Vancouver, Canada
    Posts
    985

    Re: How do I display data?

    The linker error indicates that CwelcomeScreenAppUi::CwelcomeScreenAppUi() is missing from your project. Have you included the .cpp file of this class to the project file (.mmp)?

    Antony

  8. #8
    Regular Contributor
    Join Date
    Aug 2005
    Posts
    200

    Re: How do I display data?

    Quote Originally Posted by antonypr
    The linker error indicates that CwelcomeScreenAppUi::CwelcomeScreenAppUi() is missing from your project. Have you included the .cpp file of this class to the project file (.mmp)?

    Yes, I have. Infact, its done automatically if the project is created using the Symbian Project Wizard. Here's a part of the code indicating the same:

    Code:
    DOCUMENT		  Series_60_APP_ReadMe.txt
    SOURCE            welcomeScreen.cpp
    SOURCE            welcomeScreenApplication.cpp 
    SOURCE            welcomeScreenAppView.cpp
    SOURCE            welcomeScreenAppUi.cpp
    SOURCE            welcomeScreenDocument.cpp
    However, the 'u' in welcomeScreenAppui & 'v' in welcomeScreenAppview.cpp is not in uppercase as far as the actual file names are concerned. By this I mean that the 5 files in the /src folder do not follow the same naming convention as that mentioned in the .mpp file.

    Anyways, I have renamed the files to conform with the above code. But I continue to receive the link errors.

    How would you propose I proceed?


    Best,
    wirefree

  9. #9
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Budapest, Hungary
    Posts
    28,752

    Re: How do I display data?

    Quote Originally Posted by wirefree101
    How would you propose I proceed?
    The AppUi class usually need no explicit constructor, however you have declared one in the header file.
    Solutions:
    - if you have unintentionally declared the constructor, comment or delete it from the header (probably welcomeScreenAppUi.h)
    - define the constructor, or (if you have already tried to do that) make sure that it is called CwelcomeScreenAppUi::CwelcomeScreenAppUi() - for example it is easy to forget the scope for constructors since you have to type twice the same thing (CwelcomeScreenAppUi in this case)

  10. #10
    Regular Contributor
    Join Date
    Aug 2005
    Posts
    200

    Re: How do I display data?

    Appreciate the response.

    With reference to my query, I have constructed the project using CodeWarrior's Symbian Project Wizard which generates the necessary .h files. Therefore, pertaining to welcomeScreenAppUi class, I have not had to explicitly declare constructors or destructors.

    The AppUi class usually need no explicit constructor, however you have declared one in the header file.
    Solutions:
    - if you have unintentionally declared the constructor, comment or delete it from the header (probably welcomeScreenAppUi.h)
    - define the constructor, or (if you have already tried to do that) make sure that it is called CwelcomeScreenAppUi::CwelcomeScreenAppUi() - for example it is easy to forget the scope for constructors since you have to type twice the same thing (CwelcomeScreenAppUi in this case)
    As suggested, I have modified the welcomeScreenAppui.h file. Following is a snapshot:

    Code:
    #ifndef __WELCOMESCREEN_APPUI_H__
    #define __WELCOMESCREEN_APPUI_H__
    
    #include <aknappui.h>
    
    // Forward reference
    class CwelcomeScreenAppView;
    
    class CwelcomeScreenAppUi : public CAknAppUi
        {
    public:
    
        void ConstructL();
    
    CwelcomeScreenAppUi::CwelcomeScreenAppUi();
    
        ~CwelcomeScreenAppUi();
    
    
    public: // from CAknAppUi
        void HandleCommandL(TInt aCommand);
    
    private:
        CwelcomeScreenAppView* iAppView;
        };
    
    #endif // __WELCOMESCREEN_APPUI_H__

    Please note that the IDE continues to generate the above mentioned link errors.

    Request assistance from Forum Nokia Champions.


    Best,
    wirefree101

  11. #11
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Budapest, Hungary
    Posts
    28,752

    Re: How do I display data?

    I have not really meant this solution. You should revert the change in the declaration, and check the definition of the constructor, which is likely in a .cpp file.

  12. #12
    Regular Contributor
    Join Date
    Aug 2005
    Posts
    200

    Re: How do I display data?

    Some success @ last!

    The 3 link errors associated with AppUi have resolved with the uncommenting of the welcomeScreenAppUi constructor in welcomeScreenAppUi.cpp. I had commented the same to conform with the HelloWorld example whereby the Symbian OS 2nd phase constructor was implemented using ConstructorL().

    I seem to be now in familiar territory as far as errors are concerned. The app generates 5 link errors associated with EikLabel. I say 'familiar territory' as this is the one aspect of the application that has been added to the base HelloWorld code.

    Now if someone could help me decipher what these link errors indicate:

    Code:
    Link Error   :  Undefined symbol: 'CEikLabel::CEikLabel(void) (??0CEikLabel@@QAE@XZ)'
    
    Link Error   :  Undefined symbol: 'void CEikLabel::SetTextL(class TDesC16 const &) (?SetTextL@CEikLabel@@QAEXABVTDesC16@@@Z)'
    
    Link Error   : MAKEDEF ERROR: C:\Symbian\8.0a\S60_2nd_FP2_CW\Examples\welcomeScreen\group\welcomeScreen_Data\WINSCW_UDEB\WELCOMESCREEN.inf:
    Inffile not found
    
    Link Error   :  Undefined symbol: 'CEikLabel::CEikLabel(void) (??0CEikLabel@@QAE@XZ)'
    
    Link Error   :  Undefined symbol: 'void CEikLabel::SetTextL(class TDesC16 const &) (?SetTextL@CEikLabel@@QAEXABVTDesC16@@@Z)'
    Wud gr8ly appreciate assistance.


    cheers,
    wirefree101

  13. #13
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Budapest, Hungary
    Posts
    28,752

    Re: How do I display data?

    They are reporting undefined symbols. Symbols which are not defined by you are usually defined in .lib files. However 2nd edition SDK Help-s usually do not contain description of CEik... classes, thus you can do a binary search in epoc32\release\winscw\urel\*.lib for a missing symbol (for example do a search for ??0CEikLabel@@QAE@XZ), or you can google for CEikLabel (and find http://www.symbian.com/developer/tec...CEikLabel.html rather fast). Add the required library to your project and try again.

  14. #14
    Regular Contributor
    Join Date
    Aug 2005
    Posts
    200

    Question Re: How do I display data?

    Thx for the response.

    eikcoctl.lib is present in epoc32\release\winscw\udeb and the following statement is also included in welcomeScreenAppView.cpp:

    #include <eiklabel.h>

    :confused:

  15. #15
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Budapest, Hungary
    Posts
    28,752

    Re: How do I display data?

    There are many things present in epoc32\release\winscw\udeb...
    But you have to add eikcoctl.lib to your project, more specifically you should include the line
    Code:
    LIBRARY eikcoctl.lib
    in the .mmp file of your project (and after that you should use the Re-Import command in the project menu).

Similar Threads

  1. encypting data to be sent using HTTP (MIDP 1.0)
    By dihex in forum Mobile Java Networking & Messaging & Security
    Replies: 7
    Last Post: 2005-10-27, 20:16
  2. how can i display the data in the buffer?
    By fengwangjiang in forum Symbian
    Replies: 0
    Last Post: 2003-05-12, 12:15
  3. Display question ...
    By kapot in forum Mobile Java General
    Replies: 0
    Last Post: 2002-10-14, 22:09
  4. Internet Access Config via Smart Message
    By ajbrindley in forum Smart Messaging
    Replies: 1
    Last Post: 2002-08-14, 07:56
  5. How to encode 8 bit massage with out data header
    By Nokia_Archive in forum General Messaging
    Replies: 1
    Last Post: 2002-05-18, 03:51

Posting Permissions

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