Skip to content

read_stringReadStringReadStringread_stringT_read_string🔗

Short description🔗

read_stringReadStringReadStringread_stringT_read_string — Read a string in a text window.

Warning🔗

This operator does not work in an HDevelop graphics window opened with dev_open_window.

Signature🔗

read_string( window WindowHandle, string InString, integer Length, out string OutString )void ReadString( const HTuple& WindowHandle, const HTuple& InString, const HTuple& Length, HTuple* OutString )static void HOperatorSet.ReadString( HTuple windowHandle, HTuple inString, HTuple length, out HTuple outString )def read_string( window_handle: HHandle, in_string: str, length: int ) -> str

Herror T_read_string( const Htuple WindowHandle, const Htuple InString, const Htuple Length, Htuple* OutString )

HString HWindow::ReadString( const HString& InString, Hlong Length ) const

HString HWindow::ReadString( const char* InString, Hlong Length ) const

HString HWindow::ReadString( const wchar_t* InString, Hlong Length ) const (Windows only)

string HWindow.ReadString( string inString, int length )

Description🔗

read_stringReadString reads a string with a predetermined maximum length (Lengthlengthlength) from the keyboard in the input window (= output window). The string is read from the current position of the text cursor using the current font. The maximum length has to be small enough to keep the string within the right window boundary. A default string which can be edited or simply accepted by the user may be provided. After text input the text cursor is positioned at the end of the edited string. Commands for editing:

  • RETURN finish input

  • BACKSPACE delete the character on the left side of the cursor and move the cursor to this position.

The length is stated as number of characters. If 'filename_encoding'"filename_encoding" is set to 'locale'"locale" with set_systemSetSystem, the length is stated in number of bytes.

Execution information🔗

Execution information
  • Multithreading type: reentrant (runs in parallel with non-exclusive operators).

  • Multithreading scope: global (may be called from any thread).

  • Processed without parallelization.

Parameters🔗

WindowHandlewindowHandlewindow_handle (input_control) window → (handle)HTuple (HHandle)HWindow, HTuple (IntPtr)HHandleHtuple (handle)

Window handle.

InStringinStringin_string (input_control) string → (string)HTuple (HString)HTuple (string)strHtuple (char*)

Default string (visible before input).

Default: ''""

Lengthlengthlength (input_control) integer → (integer)HTuple (Hlong)HTuple (int / long)intHtuple (Hlong)

Maximum number of characters.

Default: 3232
Restriction: Length > 0 && Length <= 1024

OutStringoutStringout_string (output_control) string → (string)HTuple (HString)HTuple (string)strHtuple (char*)

Read string.

Result🔗

read_stringReadString returns 2 (H_MSG_TRUE) if the text window is valid and a string of maximal length fits within the right window boundary. Otherwise an exception is raised.

Combinations with other operators🔗

Combinations

Possible predecessors

open_windowOpenWindow, set_fontSetFont

Alternatives

read_charReadChar, fread_stringFreadString, fread_charFreadChar

See also

set_tpositionSetTposition, new_lineNewLine, open_windowOpenWindow, set_fontSetFont, set_colorSetColor

Module🔗

Foundation