Numeric values and pasting data in a field

Numeric values and pasting data in a field

Postby driessen » Tue Nov 07, 2017 1:03 pm

Hello,

Here in Belgium, we use the comma as a decimal point.
So, a value 12345678.90 is written in Belgium like 12.345.678,90 while in most countries it is written like 12 345 678.90.

Concerning this problem, I have 2 quesions :
1. How can I use the comma as the standard decimal point in my application?
2. If I paste a value like 12.345.678,90 in a numeric field in my application, than it is shown as 12.34. How can I accomplish that a value like 12.345.678,90 which is pasted in a numeric field, results into 12345678.90?

I hope everyone can understand what I mean.

Thanks a lot in advance for any help.
Regards,

Michel D.
Genk (Belgium)
_____________________________________________________________________________________________
I use : FiveWin for (x)Harbour v. 24.07 - Harbour 3.2.0 (February 2024) - xHarbour Builder (January 2020) - Bcc773
User avatar
driessen
 
Posts: 1422
Joined: Mon Oct 10, 2005 11:26 am
Location: Genk, Belgium

Re: Numeric values and pasting data in a field

Postby Enrico Maria Giordano » Tue Nov 07, 2017 1:29 pm

Try using this PICTURE in your GET:

Code: Select all  Expand view
PICTURE "@E 99999999.99"


EMG
User avatar
Enrico Maria Giordano
 
Posts: 8710
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: Numeric values and pasting data in a field

Postby driessen » Tue Nov 07, 2017 1:53 pm

Enrico,

Thanks for you quick answer.

I used the picture you suggested.

Pasting 1 234 567.90 results into 12345670.00.
Pasting 1.234.567,90 results into 1234567.00.

Any suggestions?
Regards,

Michel D.
Genk (Belgium)
_____________________________________________________________________________________________
I use : FiveWin for (x)Harbour v. 24.07 - Harbour 3.2.0 (February 2024) - xHarbour Builder (January 2020) - Bcc773
User avatar
driessen
 
Posts: 1422
Joined: Mon Oct 10, 2005 11:26 am
Location: Genk, Belgium

Re: Numeric values and pasting data in a field

Postby Enrico Maria Giordano » Tue Nov 07, 2017 2:54 pm

Remove dots and spaces before paste. It works fine if you paste

Code: Select all  Expand view
1234567,90


EMG
User avatar
Enrico Maria Giordano
 
Posts: 8710
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: Numeric values and pasting data in a field

Postby driessen » Tue Nov 07, 2017 3:48 pm

Enrico,

But that is just the problem.

In Belgium, a value is often shown as 999.999.999,99 and if my user wants to copy this value from a Word-document for pasting it into a field, I can't ask him to remove the spaces and dots before copying.
Regards,

Michel D.
Genk (Belgium)
_____________________________________________________________________________________________
I use : FiveWin for (x)Harbour v. 24.07 - Harbour 3.2.0 (February 2024) - xHarbour Builder (January 2020) - Bcc773
User avatar
driessen
 
Posts: 1422
Joined: Mon Oct 10, 2005 11:26 am
Location: Genk, Belgium

Re: Numeric values and pasting data in a field

Postby Enrico Maria Giordano » Tue Nov 07, 2017 5:59 pm

Sorry, I don't think you can paste something like 999.999.999,99. At least without changing TGet class. Let's wait for other opinions...

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8710
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: Numeric values and pasting data in a field

Postby nageswaragunupudi » Wed Nov 08, 2017 11:49 am

Are you trying to paste into a Get?
If so, please set picture of the get as "@E ... " and paste should work perfectly. Please ensure that the picture clause is large enough for the data.
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10624
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: Numeric values and pasting data in a field

Postby Enrico Maria Giordano » Wed Nov 08, 2017 12:38 pm

This is a sample. It doesn't work with 999.999.999,99. The result is 99.999.999,00. What am I missing?

Code: Select all  Expand view
#include "Fivewin.ch"


FUNCTION MAIN()

    LOCAL oDlg

    LOCAL nVar := 0

    DEFINE DIALOG oDlg

    @ 1, 1 GET nVar;
           SIZE 100, 13;
           PICTURE "@E 999,999,999.99";
           RIGHT

    @ 3, 1 BUTTON "Close";
           ACTION oDlg:End()

    ACTIVATE DIALOG oDlg;
             CENTER

    RETURN NIL


EMG
User avatar
Enrico Maria Giordano
 
Posts: 8710
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: Numeric values and pasting data in a field

Postby nageswaragunupudi » Wed Nov 08, 2017 1:03 pm

This appears to be the limitation with TGet's untransform() method of both xHarbour and Harbour. The behaviour is the same whether we use European and American format.

With smaller numbers, this works.
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10624
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: Numeric values and pasting data in a field

Postby Enrico Maria Giordano » Wed Nov 08, 2017 3:42 pm

I don't know how to report (or to fix) this problem to the xHarbour developers list. Obviously them (and myself) will want a sample of the problem without FWH. And it is impossible because pasting in the console is exactly like using the keyboard, so at the first dot the cursor will move at the comma position. For this I think that this problem has to be solved in FWH TGet class.

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8710
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: Numeric values and pasting data in a field

Postby nageswaragunupudi » Wed Nov 08, 2017 3:48 pm

I see your point. We'll look into this. For now this is working with smaller numbers.
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10624
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: Numeric values and pasting data in a field

Postby driessen » Wed Nov 08, 2017 10:28 pm

Glad that everyone sees the problem.

Thanks for your efforts. I'm looking forward to a solution.
Regards,

Michel D.
Genk (Belgium)
_____________________________________________________________________________________________
I use : FiveWin for (x)Harbour v. 24.07 - Harbour 3.2.0 (February 2024) - xHarbour Builder (January 2020) - Bcc773
User avatar
driessen
 
Posts: 1422
Joined: Mon Oct 10, 2005 11:26 am
Location: Genk, Belgium

Re: Numeric values and pasting data in a field

Postby nageswaragunupudi » Thu Nov 09, 2017 12:17 am

2. If I paste a value like 12.345.678,90 in a numeric field in my application, than it is shown as 12.34. How can I accomplish that a value like 12.345.678,90 which is pasted in a numeric field, results into 12345678.90?

The value 12.345.678,90 when pasted results in 12345678.90. Please try Mr EMG's sample
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10624
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: Numeric values and pasting data in a field

Postby nageswaragunupudi » Thu Nov 09, 2017 2:22 am

Enrico Maria Giordano wrote:This is a sample. It doesn't work with 999.999.999,99. The result is 99.999.999,00. What am I missing?

Code: Select all  Expand view
#include "Fivewin.ch"


FUNCTION MAIN()

    LOCAL oDlg

    LOCAL nVar := 0

    DEFINE DIALOG oDlg

    @ 1, 1 GET nVar;
           SIZE 100, 13;
           PICTURE "@E 999,999,999.99";
           RIGHT

    @ 3, 1 BUTTON "Close";
           ACTION oDlg:End()

    ACTIVATE DIALOG oDlg;
             CENTER

    RETURN NIL


EMG

Please change the picture as "@E 99,999,999,999.99" and pasting "999.999.999,99" works correctly.
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10624
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: Numeric values and pasting data in a field

Postby driessen » Thu Nov 09, 2017 8:49 am

Mr. Rao,

I'm sorry but your suggestion is not working correctly.
I changed my picture to "@E 99,999,999,999.99".
If I paste "1.234.567,89", it results into "1.234.567,90".
If I paste "1.234.567.78", it results into "1.234.567.80".
Regards,

Michel D.
Genk (Belgium)
_____________________________________________________________________________________________
I use : FiveWin for (x)Harbour v. 24.07 - Harbour 3.2.0 (February 2024) - xHarbour Builder (January 2020) - Bcc773
User avatar
driessen
 
Posts: 1422
Joined: Mon Oct 10, 2005 11:26 am
Location: Genk, Belgium

Next

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 45 guests