Previous Page Next Page Contents

Pref::postInput -- actions after input

Introduction

With Pref::postInput, actions directly after the data input can be initiated.

Call(s)

Pref::postInput(value)

Parameters

value - function to be executed after data input

Returns

the previously defined function

Related Functions

Pref::postOutput, Pref::promptString

Details

Example 1

Pref::postInput will be used to numerate the input lines in joint with Pref::promptString. The global variable NumberOfLine must be initialized with 0. This all can be done in the file ``userinit.mu''.

>> NumberOfLine:= 0:
   Prompt:= Pref::promptString():
   Pref::postInput(proc()
                   begin
                     NumberOfLine:= NumberOfLine + 1;
                     Pref::promptString(expr2text(NumberOfLine) . Prompt)
                   end_proc):

Example 2

Time mesure in seconds.

>> Pref::postInput(() -> (TIME:= time())):
   Pref::postOutput(proc()
                      local Time;
                    begin
                      Time:= trunc((time() - TIME)/1000);
                      stringlib::format("Time: ".expr2text(Time)." s",
                                        TEXTWIDTH, Right)
                    end_proc):
   T:= time(): while time() - T < 1000 do null() end_while
                                                            Time: 2 s

The output depends on the value of the variable TEXTWIDTH.

Changes




Do you have questions or comments?


Copyright © SciFace Software GmbH & Co. KG 2000