BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

tagCY and Currency

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (ActiveX)
View previous topic :: View next topic  
Author Message
Treak
Guest





PostPosted: Fri Jul 07, 2006 8:10 am    Post subject: tagCY and Currency Reply with quote



Hello All.
I have a OCX file written in BDS 2006, there are some CURRENCY
propertys, if i use a app in VS 6.0 or a app in BDS the Currency type
and the tagCY is diffrent in BDS 500 to a Currency is 5000000 and in the
VS the tagCY.int64 = 500 .
Do I miss something or ?

Regards Christer
Back to top
Remy Lebeau (TeamB)
Guest





PostPosted: Fri Jul 07, 2006 8:10 am    Post subject: Re: tagCY and Currency Reply with quote



"Treak" <christer.borgqvist (AT) glocalnet (DOT) net> wrote in message
news:44ade4e8$1 (AT) newsgroups (DOT) borland.com...

Quote:
in BDS 500 to a Currency is 5000,000

The value is being scaled upwards by 10,000. That is what the Currency and
CY types are supposed to do.

Quote:
and in the VS the tagCY.int64 = 500 .

Then you are not assigning the value as a proper CY value. In COM, the CY
type also scales upward by 10,000. How exactly are you assigning the value
to begin with?


Gambit
Back to top
Treak
Guest





PostPosted: Fri Jul 07, 2006 9:11 pm    Post subject: Re: tagCY and Currency Reply with quote



Remy Lebeau (TeamB) skrev:
Quote:
"Treak" <christer.borgqvist (AT) glocalnet (DOT) net> wrote in message
news:44ade4e8$1 (AT) newsgroups (DOT) borland.com...


in BDS 500 to a Currency is 5000,000


The value is being scaled upwards by 10,000. That is what the Currency and
CY types are supposed to do.


and in the VS the tagCY.int64 = 500 .


Then you are not assigning the value as a proper CY value. In COM, the CY
type also scales upward by 10,000. How exactly are you assigning the value
to begin with?


Gambit


Promably I dont assign the value right, so kindly tell me!

Regards Christer
Back to top
Remy Lebeau (TeamB)
Guest





PostPosted: Fri Jul 07, 2006 9:37 pm    Post subject: Re: tagCY and Currency Reply with quote

"Treak" <christer.borgqvist (AT) glocalnet (DOT) net> wrote in message
news:44ae87ef (AT) newsgroups (DOT) borland.com...

Quote:
Promably I dont assign the value right, so kindly tell me!

I can't answer that until you show the code that is not working for you.


Gambit
Back to top
Treak
Guest





PostPosted: Sat Jul 08, 2006 1:45 pm    Post subject: Re: tagCY and Currency Reply with quote

Remy Lebeau (TeamB) skrev:
Quote:
"Treak" <christer.borgqvist (AT) glocalnet (DOT) net> wrote in message
news:44ae87ef (AT) newsgroups (DOT) borland.com...


Promably I dont assign the value right, so kindly tell me!


I can't answer that until you show the code that is not working for you.


Gambit


CY amount1;

amount1.int64 = 500;
m_pad.SetTotalAmount(amount1);
Back to top
Treak
Guest





PostPosted: Sat Jul 08, 2006 1:51 pm    Post subject: Re: tagCY and Currency Reply with quote

Treak skrev:
Quote:
Remy Lebeau (TeamB) skrev:

"Treak" <christer.borgqvist (AT) glocalnet (DOT) net> wrote in message
news:44ae87ef (AT) newsgroups (DOT) borland.com...


Promably I dont assign the value right, so kindly tell me!



I can't answer that until you show the code that is not working for you.


Gambit


CY amount1;
amount1.int64 = 500;
m_pad.SetTotalAmount(amount1);
If You need the code there must me several ways to assign a value to a

tagCY or?
Regards Christer.
Back to top
Remy Lebeau (TeamB)
Guest





PostPosted: Sun Jul 09, 2006 1:22 am    Post subject: Re: tagCY and Currency Reply with quote

"Treak" <christer.borgqvist (AT) glocalnet (DOT) net> wrote in message
news:44af70c5$1 (AT) newsgroups (DOT) borland.com...

Quote:
CY amount1;
amount1.int64 = 500;

That is your mistake. You are explicitally assigning 500 to CY when you
need to assign 5000000 instead. Unlike the VCL's Currency class, CY is just
a structure with no methods of its own, so it can't scale the value
automatically. COM passes around exactly the value that you supply. That
is why the value is still 500 inside of SetTotalAmount(). You need to scale
the value manually yourself, ie:

amount1.int64 = 500 * 10000;

Alternatively, you can use the ATL's CComCurrency class in your VS code, ie:

#include <atlcur.h>

CComCurrency amount1;
amount1 = 500.0000; // <-- notice it is a floating point value
m_pad.SetTotalAmount(amount1);

Or:

#include <atlcur.h>

CComCurrency amount1(500, 0); // <-- specify the integer and fraction
separately
m_pad.SetTotalAmount(amount1);


Gambit
Back to top
Treak
Guest





PostPosted: Sun Jul 09, 2006 3:08 am    Post subject: Re: tagCY and Currency Reply with quote

Remy Lebeau (TeamB) skrev:
Quote:
"Treak" <christer.borgqvist (AT) glocalnet (DOT) net> wrote in message
news:44af70c5$1 (AT) newsgroups (DOT) borland.com...


CY amount1;
amount1.int64 = 500;


That is your mistake. You are explicitally assigning 500 to CY when you
need to assign 5000000 instead. Unlike the VCL's Currency class, CY is just
a structure with no methods of its own, so it can't scale the value
automatically. COM passes around exactly the value that you supply. That
is why the value is still 500 inside of SetTotalAmount(). You need to scale
the value manually yourself, ie:

amount1.int64 = 500 * 10000;

Alternatively, you can use the ATL's CComCurrency class in your VS code, ie:

#include <atlcur.h

CComCurrency amount1;
amount1 = 500.0000; // <-- notice it is a floating point value
m_pad.SetTotalAmount(amount1);

Or:

#include <atlcur.h

CComCurrency amount1(500, 0); // <-- specify the integer and fraction
separately
m_pad.SetTotalAmount(amount1);


Gambit


Thanks for Your very detaild answer.

Regards Christer.
Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (ActiveX) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.