Highlighted
Absent Member.
Absent Member.
2367 views

[archive] Comma and dot

[Migrated content. Thread originally posted on 27 July 2007]

Hi all

I have trouble with my application i can't solve atm.

Like u know, when u use an application like for example Excel or Word, if u push on the num-pad key for the dot, u can have dot or comma depending from the International Option Settings in Windows Control Panel.

In my Acucobol Application when i push the dot key on the num-pad i have always the '.' and never the comma, also when i change the International Control Panel Setting from '.' to ',' for the Decimal Separate character.

Can someone give me a tip to solve this problem?
Ty to all.

Donant.
0 Likes
9 Replies
Highlighted
Absent Member.
Absent Member.

RE: [archive] Comma and dot

You need to set COMMA in SPECIAL-NAMES, like:

       SPECIAL-NAMES.   DECIMAL-POINT IS COMMA.
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] Comma and dot

Try to change the keyboard layout of the input language.
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] Comma and dot

I know this command, but my request is different, maybe i didn't explained well...

In every Microsoft Office applications like Excel for example, the simply change of the International setting about the decimal separation (maybe '.' in Usa and ',' in Italy) change the character in the numeric pad. If i use '.' as decimal separator in the International setting one 'dot' will appear from the press of the key and if i change the international setting into ',' pressing the '.' key a ',' will appear. This is all ok because only the num pad is changed, the normal key on the keyborad for '.' and ',' are not changed.
The fact is: in a normal entry-field if i press the key '.' on the numeric pad a 'dot' will always appear.

I'm doing something wrong?
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] Comma and dot

Can you provide a demo program? (small!)
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] Comma and dot

But... is the same in all my programs.

When i use the key of the 'dot' on the right side of the keyboard near the zero (on the numeric pad) ALWAYS a 'dot' appear, also when i change the international setting. I mean when i use the key in all the controls, like entry filelds, grid and so on.
In all the others windows application if i have changed the international setting for the decimal separation, automatically if i hit the key 'dot' on the numeric pad a comma will appear.

Maybe there is some runtime option i don't know...
I want only to know if this always happens to all or i have something wrong.

I can provide a little simple program if u need it... but it's seams like useless in this case.
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] Comma and dot

Example program.
An entry-field where i tested the same problem.

       identification division.
       program-id.
           test1.
       author. donant.
       date-written. 07 Agosto 2007.
      *-----------------------------------------------------------------*
      *    Test1
      *-----------------------------------------------------------------*
       environment division.

       SPECIAL-NAMES.
       input-output section.

       FILE-CONTROL.
       data division.
       FILE SECTION.
       working-storage section.

      *{Bench}acu-def
       COPY "acugui.def".
       COPY "acucobol.def".
       COPY "crtvars.def".
       COPY "showmsg.def".
      *{Bench}end

      *WKS external
       COPY "fonts.def".
      *

      *--- Dati per handle di floating windows.       ---*
       77  win-video-initial  handle of window.
       77  win-video-via      handle of window.

      *--- handle di thread
       77  attesa-thread      handle of thread.

      *--- Fonts
       01  we-dati-font.
               07  fixed-font        handle of font.
               07  traditional-font  handle of font.
               07  default-font      handle of font.
               07  large-font        handle of font.
               07  medium-font       handle of font.
               07  small-font        handle of font.

       77  key-status
           is special-names crt status     pic 9(4).
           88  button-ok-pushed      value 13.
           88  button-exit-pushed    value 27.
           88  button-timeout        value 300.

      *--- Label dei files                           ---*

      *--- Campi utilizzo vario                      ---*
       77  ind                    pic 9(02)  value zeros.

       01  calling-program        pic x(15).
       77  call-status            pic s99.
           88 call-ok             value 1.
           88 top-level           value 0.
           88 call-unknown        value -1.

       linkage section.

       screen section.

      * test1.scr
      * test1.scr is generated from J:\cobges\test1.Psf
      * This is a generated file. DO NOT modify this file directly.
           
       01 video-via.
           03 Screen1-Ef-1, Entry-Field,
              COL 2.80, LINE 1.67, LINES 1.67 CELLS, SIZE 27.60 CELLS,
              3-D, COLOR IS 2, FONT IS Default-Font, ID IS 2.
           03 Screen1-Pb-1, Push-Button,
              COL 17.20, LINE 4.33, LINES 2.00 CELLS, SIZE 13.20 CELLS,
              EXCEPTION-VALUE 13, FONT IS Default-Font, ID IS 1,
              TITLE "OK".

       procedure division.
       normal section.
       inizio-prog.

           call "c$calledby" using calling-program giving call-status.

           if top-level

              call "kernel32.dll"

              display initial window handle is win-video-initial
                           user-colors, lines 17 size 30
                           background-low,
                           control font fixed-font
                           color black + bckgrnd-white,
                           title "Test1", title-bar
                           visible 0

           end-if.

           display floating window handle is win-video-via
               cell height 18,
               cell width  10,
               title "Test",
               title-bar,
               size  31.20,
               lines 6.33,
               system menu.

           display video-via.

       chiedo-via.
           perform with test after until button-exit-pushed or
                                         button-ok-pushed 
              accept video-via

           end-perform.

           destroy win-video-via.
           destroy win-video-initial.
       fine.
           exit program.
           stop run.
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] Comma and dot

A few things:
Your screen section entry field is not tied to a data item where a decimal point or comma is expected (like this):
01 my-data pic 99.99.
linkage section.
screen section.
01 video-via.
03 Screen1-Ef-1, Entry-Field,
COL 3, LINE 2, LINES 2 CELLS, SIZE 28 CELLS,
3-D, COLOR IS 2, FONT IS Default-Font, ID IS 2
value my-data.
You may need to tab or click onto another field (like the push button) to see the decimal point change to a comma
Are you executing the program with the configuration variable:
'DECIMAL_POINT' to ','
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] Comma and dot

A keystroke in Windows comes along with various flags, indicating the state of numlock, ctrl, shift, scrollock, capslock *and* if the key comes from the numeric keypad.

What various applications does to auto cast the period / comma on the numeric keypad into the appropriate decimal point is that when they receive a period or a comma, they check this aforementioned flag to see if it is in fact coming from the numeric keyboard. Then, as it is from the numeric keyboard it is assumed safe to twist this value into whatever is defined as the decimal point in the locale settings.

Unfortunately, as you have discovered, ACUCOBOL-GT does not do this. Nor is there a way you can detect this and override it yourself. I am sorry.
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] Comma and dot

Try this code:

IF RIMAPPA-PUNTO
SET ENVIRONMENT "KEYSTROKE" TO "Data=46 44"
SET ENVIRONMENT "KEYSTROKE" TO "Data=44 46"
ELSE
SET ENVIRONMENT "KEYSTROKE" TO "Data=46 46"
SET ENVIRONMENT "KEYSTROKE" TO "Data=44 44"
END-IF.


Miceli Umberto
Freelance Photographer and Web Site Developer
http://joeyramone76.altervista.org
0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.