TADS 3: inputLine

[code]+ mathproblem: Readable, Thing ‘note/paper/message’ ‘note’
“A piece of paper with writing on it”

math_answer = nil

dobjFor(Read)
{
           
    action()
    {
        "<TABLE BORDER=1 CELLPADDING=15 WIDTH=\"25%\">
        <TR BGCOLOR=\"#5EE9FF\">
        <TD WIDTH=60% BGCOLOR=\"#EEDFCC\">
        If one person shovels, the snow pile can be cleared in 57 minutes.\b
        \b
        If three people shovel, how long will it take to remove the snow pile?\b
        \b
        </TD> 
        </TR>
        </TABLE>\b\b";
   /*     flushOutput(); */
        math_answer = inputLine();
    }
}

;
[/code]

When this code executes, the following occurs:

  1. The program pauses, waiting for the user’s input;
  2. After the user presses the “Enter” key, the table appears.

That’s wrong. I need the table to appear first. Then, I need the program to pause for the user’s input.

Note: I tried the flushOutput command…didn’t fix the problem.

====================================================================

If inputLine is not the best way to handle an open-ended response from the user, I’m open to other suggestions.

Thanks. Jeff

The easiest answer is to change

math_answer = inputLine();

to

math_answer = inputManager.getInputLine(nil, nil);

That way, inputManager will handle flushing the output for you.

You can find more information this in Eric Eve’s article Some Common Input/Output Issues.

You’re right, Emily. Thanks for the guidance.

Jeff