[Stackoverflow] [Progress OpenEdge ABL] Loop while public void in class is false

Status
Not open for further replies.
B

Bazilby

Guest
I'm trying to work out the correct syntax to loop for correct user input while a class returns false.

validate.cls file

******DEFINITIONS and other code********

METHOD PUBLIC VOID isEntryCorrect (INPUT userEntry AS CHARACTER):
DEFINE VARIABLE cLogical as LOGICAL NO-UNDO.
IF userEntry = "wrong" THEN
DO:
cLogical = FALSE.
END.
ELSE IF userEntry = "right" THEN
DO:
cLogical = TRUE.
END.

END METHOD.


There is a .w file that accepts user input on Button click and assigns the FILL-IN:SCREEN-VALUE to a variable and then passes it the method in the class.

UserInput.w file

****class definition***
DEFINE VAR userInput as validate NO-UNDO.
userInput = NEW validate("").

****local variable definition****
DEF VAR windowInput AS CHARACTER NO-UNDO.
DEF VAR iCount as INTEGER NO_UNDO INITIAL 0.

windowInput = FILL-IN:SCREEN-VALUE.


But that windowInput needs to be passed to the method. This is where I am stuck.

I need the program to loop and keep asking for the user to enter the correct string while the method is false, but I cannot seem to work out the correct syntax or if I'm on the wrong train of thought.

My thinking is that I could use a DO WHILE to keep looping with a counter to terminate.

****the incorrect code*****
DO WHILE userInput:isEntryCorrect(windowInput) <> TRUE OR iCOunt = 3:

windowInput = FILL-IN:SCREEN-VALUE.
iCount = iCount + 1.
END.


If this actually worked it would probably keep looping until the count of three and then continue with the rest of the program.

Continue reading...
 
Status
Not open for further replies.
Top