Highlighted
Absent Member.
Absent Member.
664 views

[archive] Setting auto-spin min and max values at runtime

[Migrated content. Thread originally posted on 23 February 2004]

Is it possible to set the min-val and max-val of an auto-spin control at runtime?

It doesn't seem to be working for me.

I have a screen section entry with a control like this:

03 EF-PER-QTR, Entry-Field,
COL 14, LINE 4, LINES 1.33 CELLS, SIZE 5.00 CELLS,
3-D, FONT IS Small-Font, ID IS 16, MAX-TEXT 2, AUTO-SPIN,
VALUE MY-VAR, VISIBLE PER-QTR-VISIBLE.

Sometimes I want this field to be able to allow values between 0 and 12 and other times a value between 1 and 4.

After the screen (at the 01 level) has been displayed, I tried:

MODIFY EF-PER-QTR, MIN-VAL = 1, MAX-VAL = 4

and

MODIFY EF-PER-QTR, MIN-VAL 1, MAX-VAL 4

Both compile, but neither have any effect - the field still allows any value.
0 Likes
2 Replies
Highlighted
Absent Member.
Absent Member.

RE: [archive] Setting auto-spin min and max values at runtime

This here works fine.

       IDENTIFICATION               DIVISION.
       PROGRAM-ID.                  SPIN-DEMO.
       ENVIRONMENT                  DIVISION.
       CONFIGURATION                SECTION.
       SPECIAL-NAMES.
       WORKING-STORAGE SECTION.

       77  CNTL-FONT                USAGE HANDLE OF FONT SMALL-FONT.
       77  MY-VAR                   PIC 9(02).
       77  KEY-STATUS               IS SPECIAL-NAMES
           CRT STATUS               PIC 9(4) VALUE 0.
           88  EXIT-PRESSED         VALUE 27.

       SCREEN      SECTION.
       01  SPIN-SCREEN.
           03 EF-PER-QTR, Entry-Field,
              COL 14, LINE 4, LINES 1.33 CELLS, SIZE 5.00 CELLS,
              3-D, MAX-TEXT 2, AUTO-SPIN,
              VALUE MY-VAR.

           03      PUSH-BUTTON
                   LINE             13
                   COL              63
                   SIZE             14
                   TITLE            "E&xit"
                   SELF-ACT
                   EXCEPTION-VALUE  = 27.

       PROCEDURE DIVISION.
       MAIN-LOGIC.

           DISPLAY STANDARD         GRAPHICAL WINDOW
                   TITLE            "Spin demo"
                   CONTROL          FONT CNTL-FONT
                   SIZE             80
                   LINES            15
                   BACKGROUND-LOW.

       PERFORM INITIALIZE-DATA.
           DISPLAY SPIN-SCREEN.
           MODIFY  EF-PER-QTR
                   MIN-VAL          = 1
                   MAX-VAL          = 4.
           PERFORM WITH TEST AFTER  UNTIL EXIT-PRESSED
                   ACCEPT           SPIN-SCREEN
           END-PERFORM.
           DESTROY SPIN-SCREEN.
           STOP    RUN.

       INITIALIZE-DATA.

           INITIALIZE               KEY-STATUS.
           EXIT    PARAGRAPH.


Are you setting it inside an event? If so, try DISPLAY EF-PER-QTR inside the event.
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] Setting auto-spin min and max values at runtime

Sigh...

It was one of those problems where you go home and come back the next day and the solution jumps right out at you.

I was doing the MODIFY of the 03 level item before I displayed the screen (01 level).

I played with this for almost a half hour late yesterday. I came in this morning and started looking at it again and I saw the problem in a few seconds...

(A thought that just came to mind, and I don't know if this is possible, but I'd love to see a runtime/debugger option that popped up a message if you try to modify a screen section entry that has not been displayed yet.)
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.