GUI.SetEchoChar

OpenTuring

GUI.SetEchoCharPart of GUI module

Syntax   GUI.SetEchoChar (widgetID : int, echoChar : char)

Description   The GUI.SetEchoChar procedure is used with text fields, especially when using a text field to input a password. When the GUI.SetEchoChar is called with a text field, any character entered into the text field will appear as the character specified by inputChar.

This allows you to use the text field to enter a password. The characters that the user types will be echoed with the character specified by inputChar (often an asterisk).

Example   This program displays a text field. As the user enters characters, each character is represented as a '*'. When the user enters return, the program exits after displaying the actual text entered into the text field.

        import GUI

        procedure EchoString (s : string)
            put "You entered \"", s, "\""
            GUI.Quit
        end EchoString

        var tf := GUI.CreateTextField (10, 100, 100, "", EchoString)
        GUI.SetEchoChar (tf, '*')
        loop
            exit when GUI.ProcessEvent
        end loop

Execute  

Details   Note that the echoChar argument to GUI.SetEchoChar must be a character, not a string. This means the character should be enclosed in single quote marks ('), not double quotes (").

Status   Exported qualified.

This means that you can only call the function by calling GUI.SetEchoChar, not by calling SetEchoChar.