PDA

View Full Version : Setting auto-spin min and max values at runtime


JoeD
02-23-2004, 02:19 PM
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.

gforseth
02-23-2004, 10:42 PM
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.

JoeD
02-24-2004, 06:08 AM
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.)