×

Discussion Board

Results 1 to 4 of 4
  1. #1
    Regular Contributor
    Join Date
    Feb 2009
    Posts
    287

    how can i pass value pass one class to another??

    Hi
    I have developed the following code . In the below mentioned code ivaluebuffer has been used in the header helloworldbasicappui.h and is declared as public. i need to get the values from ivaluebuffer to msg.cpp class. I tried to get that by creating an object, but am getting a null value. Please help me to solve this




    helloworldbasicappui.cpp
    Code:
    void CHelloWorldBasicAppUi::ConstructL()
        {
    TBuf<50> avalue;
       TBuf<50> bvalue;
        avalue.Num(ivalue, numberFormat);
         	avalue.Num(ivalue1, numberFormat);
         	bvalue.Append(lbvalue);
         ivaluebuffer.Copy(avalue);
    }
    decalaration ivaluebuffer

    helloworldbasicappui.h

    Code:
    class CHelloWorldBasicAppUi : public CAknAppUi
        {
        public: // Constructors and destructor
        	    	 
        	TBuf<50> ivaluebuffer;
        	      	
            /**
            * ConstructL.
            * 2nd phase constructor.
            */
            void ConstructL();
    msg.cpp
    Code:
    CHelloWorldBasicAppUi* derived =new (ELeave) CHelloWorldBasicAppUi();
    _LIT("number","07655556")
    TRAP(error, SendSmsL(number, derived->ivaluebuffer));

  2. #2
    Nokia Developer Moderator
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,169

    Re: how can i pass value pass one class to another??

    you could get pointer to your appui from anywhere inside the application with environment variable, thus you could do something,like this to get your buffer:

    STATIC_CAST(CHelloWorldBasicAppUi *,CEikonEnv::Static()->AppUI())->ivaluebuffer;

  3. #3
    Regular Contributor
    Join Date
    Feb 2009
    Posts
    287

    Re: how can i pass value pass one class to another??

    Quote Originally Posted by symbianyucca View Post
    you could get pointer to your appui from anywhere inside the application with environment variable, thus you could do something,like this to get your buffer:

    STATIC_CAST(CHelloWorldBasicAppUi *,CEikonEnv::Static()->AppUI())->ivaluebuffer;
    hi,symbianyucca thanks for your reply


    this is not working in this case , I have two class CKeyCapturera and CKeyCapturer

    my requerment is pass the value of ivaluebuffer from CKeyCapturera to CKeyCapturer.please help me.

    Code:
    void CKeyCapturera::RunL()
        {
    TBuf<50> avalue;
     TBuf<50> bvalue;
     avalue.Num(ivalue, numberFormat);
     avalue.Num(ivalue1, numberFormat);
      bvalue.Append(lbvalue);
    ivaluebuffer.Copy(avalue);
    }
    another class

    Code:
    void CKeyCapturer::RunL()
    {
      _LIT(num,"9961927812");
    //STATIC_CAST(CHelloWorldBasicAppUi *,CEikonEnv::Static()->AppUI())->ivaluebuffer;
     TRAP(error, SendSmsL(num, ivaluebuffer));
    
    
    }

  4. #4
    Nokia Developer Moderator
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,169

    Re: how can i pass value pass one class to another??

    you could store it still in your appui, and maybe implement getter & setter functions, so you could read & write the values from anywhere inside your app..

Similar Threads

  1. Issue when trying to generate .sis file
    By rmulam in forum Symbian Tools & SDKs
    Replies: 9
    Last Post: 2009-08-13, 14:10
  2. Java Application running on WTK but not on S60 SDK
    By roman.benz in forum Mobile Java Tools & SDKs
    Replies: 6
    Last Post: 2009-06-09, 14:38
  3. Error Error where are u ??
    By Abhishek_karmakar in forum Symbian
    Replies: 14
    Last Post: 2008-10-20, 09:29
  4. External Linking Error (Undefined Symbol)
    By nile_mail in forum Symbian
    Replies: 2
    Last Post: 2008-08-05, 13:10
  5. Exceptions while loading application
    By avinash_rs in forum Mobile Java General
    Replies: 0
    Last Post: 2003-06-09, 10:53

Posting Permissions

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