×

Discussion Board

Results 1 to 5 of 5
  1. #1
    Registered User
    Join Date
    Dec 2008
    Posts
    20

    problem TReal to descriptor??

    Code:
    CEikFloatingPointEditor* nameEditor = static_cast<CEikFloatingPointEditor*>(ControlOrNull(EOpponentFormDlgCIdEdwin));
    CEikFloatingPointEditor* heightEditor = static_cast<CEikFloatingPointEditor*>(ControlOrNull(EOpponentFormDlgCIdEdwin1));
    
    	TReal bmi = 0;
    	TReal bmi1 = 0;
    	TReal bodymass = 0;
    	nameEditor->GetValueAsReal(bmi);
    	heightEditor->GetValueAsReal(bmi1);
    	
    	TReal x = 0;
    	Math::Pow(x,bmi1,2);
    
    	bodymass = bmi / x;
    	iName.Num(bodymass);
    in this code i am getting an input from user on FORM as a REAL Integer then doing calculation and after that i am using NUM() function to write a Real value to iName (descriptor) but it doest copy a decimal part of the resultant number. Any suggestion/ help plz...

  2. #2
    Nokia Developer Champion
    Join Date
    Jun 2008
    Location
    Noida,India
    Posts
    3,987

    Re: problem TReal to descriptor??

    use the following:

    TRealFormat realFormat1;
    //type of format, use KDoNotUseTriads if u do not want to allow tried character
    // realFormat.iType = KRealFormatFixed || KDoNotUseTriads;
    //width your number
    realFormat1.iWidth = 4;
    //number of character after decimal point
    realFormat1.iPlaces = 2;
    realFormat1.iTriLen = 2;

    Now in Num() pass it like this:

    ibuf.Num(bodymass,realFormat1);

  3. #3
    Nokia Developer Champion
    Join Date
    Jan 2008
    Location
    Moscow, Russia
    Posts
    3,348

    Re: problem TReal to descriptor??

    Try to use this:
    Code:
    _LIT(KRealFormat,"%.2f");
    iName.AppendFormat(KRealFormat, bodymass);

  4. #4
    Registered User
    Join Date
    Dec 2008
    Posts
    20

    Re: problem TReal to descriptor??

    Quote Originally Posted by A.A.M. View Post
    Try to use this:
    Code:
    _LIT(KRealFormat,"%.2f");
    iName.AppendFormat(KRealFormat, bodymass);
    yeh the code worked... many thanks for your cooperation
    zahid

    i would like to make one point include <e32const.h> to use the above mentioned command.

  5. #5
    Super Contributor
    Join Date
    Oct 2007
    Location
    જુનાગઢ - India
    Posts
    3,034

    Re: problem TReal to descriptor??

    Note that AppendFormat() will append data at the end of descriptor, so before calling AppendFormat() second time make it zero using Zero() method. Or use Num(), as suggested by vineet, which replace any existing data before copying new data into descriptor.

Similar Threads

  1. Problem with CAknDoubleStyleListBox with a CAknSearchField
    By jjig in forum Symbian User Interface
    Replies: 2
    Last Post: 2009-09-17, 00:58
  2. Descriptor Problem
    By davmt in forum Symbian
    Replies: 13
    Last Post: 2008-03-19, 17:42
  3. descriptor problem
    By sandy_zeng in forum Symbian
    Replies: 1
    Last Post: 2008-01-06, 17:26
  4. sizeof Descriptor offset problem
    By kester76 in forum Symbian
    Replies: 2
    Last Post: 2006-12-07, 09:18
  5. About 6230 Bt Problem
    By eerkek in forum Bluetooth Technology
    Replies: 17
    Last Post: 2005-02-08, 12:33

Posting Permissions

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