Page 1 of 2

Numeric values and pasting data in a field

PostPosted: Tue Nov 07, 2017 1:03 pm
by driessen
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.

Re: Numeric values and pasting data in a field

PostPosted: Tue Nov 07, 2017 1:29 pm
by Enrico Maria Giordano
Try using this PICTURE in your GET:

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


EMG

Re: Numeric values and pasting data in a field

PostPosted: Tue Nov 07, 2017 1:53 pm
by driessen
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?

Re: Numeric values and pasting data in a field

PostPosted: Tue Nov 07, 2017 2:54 pm
by Enrico Maria Giordano
Remove dots and spaces before paste. It works fine if you paste

Code: Select all  Expand view
1234567,90


EMG

Re: Numeric values and pasting data in a field

PostPosted: Tue Nov 07, 2017 3:48 pm
by driessen
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.

Re: Numeric values and pasting data in a field

PostPosted: Tue Nov 07, 2017 5:59 pm
by Enrico Maria Giordano
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

Re: Numeric values and pasting data in a field

PostPosted: Wed Nov 08, 2017 11:49 am
by nageswaragunupudi
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.

Re: Numeric values and pasting data in a field

PostPosted: Wed Nov 08, 2017 12:38 pm
by Enrico Maria Giordano
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

Re: Numeric values and pasting data in a field

PostPosted: Wed Nov 08, 2017 1:03 pm
by nageswaragunupudi
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.

Re: Numeric values and pasting data in a field

PostPosted: Wed Nov 08, 2017 3:42 pm
by Enrico Maria Giordano
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

Re: Numeric values and pasting data in a field

PostPosted: Wed Nov 08, 2017 3:48 pm
by nageswaragunupudi
I see your point. We'll look into this. For now this is working with smaller numbers.

Re: Numeric values and pasting data in a field

PostPosted: Wed Nov 08, 2017 10:28 pm
by driessen
Glad that everyone sees the problem.

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

Re: Numeric values and pasting data in a field

PostPosted: Thu Nov 09, 2017 12:17 am
by nageswaragunupudi
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

Re: Numeric values and pasting data in a field

PostPosted: Thu Nov 09, 2017 2:22 am
by nageswaragunupudi
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.

Re: Numeric values and pasting data in a field

PostPosted: Thu Nov 09, 2017 8:49 am
by driessen
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".