FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Numeric values and pasting data in a field
Posts: 1467
Joined: Mon Oct 10, 2005 11:26 AM
Numeric values and pasting data in a field
Posted: Tue Nov 07, 2017 01: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. 25.12 - Harbour 3.2.0 (May 2025) - xHarbour Builder (January 2020) - Bcc773

Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: Numeric values and pasting data in a field
Posted: Tue Nov 07, 2017 01:29 PM
Try using this PICTURE in your GET:

Code (fw): Select all Collapse
PICTURE "@E 99999999.99"


EMG
Posts: 1467
Joined: Mon Oct 10, 2005 11:26 AM
Re: Numeric values and pasting data in a field
Posted: Tue Nov 07, 2017 01: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. 25.12 - Harbour 3.2.0 (May 2025) - xHarbour Builder (January 2020) - Bcc773

Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: Numeric values and pasting data in a field
Posted: Tue Nov 07, 2017 02:54 PM
Remove dots and spaces before paste. It works fine if you paste

Code (fw): Select all Collapse
1234567,90


EMG
Posts: 1467
Joined: Mon Oct 10, 2005 11:26 AM
Re: Numeric values and pasting data in a field
Posted: Tue Nov 07, 2017 03: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. 25.12 - Harbour 3.2.0 (May 2025) - xHarbour Builder (January 2020) - Bcc773

Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: Numeric values and pasting data in a field
Posted: Tue Nov 07, 2017 05: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

Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: Numeric values and pasting data in a field
Posted: 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
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: Numeric values and pasting data in a field
Posted: 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 (fw): Select all Collapse
#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
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: Numeric values and pasting data in a field
Posted: Wed Nov 08, 2017 01: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
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: Numeric values and pasting data in a field
Posted: Wed Nov 08, 2017 03: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

Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: Numeric values and pasting data in a field
Posted: Wed Nov 08, 2017 03: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
Posts: 1467
Joined: Mon Oct 10, 2005 11:26 AM
Re: Numeric values and pasting data in a field
Posted: 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. 25.12 - Harbour 3.2.0 (May 2025) - xHarbour Builder (January 2020) - Bcc773

Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: Numeric values and pasting data in a field
Posted: 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
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: Numeric values and pasting data in a field
Posted: Thu Nov 09, 2017 02: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 (fw): Select all Collapse
#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
Posts: 1467
Joined: Mon Oct 10, 2005 11:26 AM
Re: Numeric values and pasting data in a field
Posted: Thu Nov 09, 2017 08: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. 25.12 - Harbour 3.2.0 (May 2025) - xHarbour Builder (January 2020) - Bcc773