read_stringT_read_stringReadStringReadStringread_string (算子)

名称

read_stringT_read_stringReadStringReadStringread_string — 在文本窗口中读取字符串。

警告

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

签名

read_string( : : WindowHandle, InString, Length : OutString)

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

void ReadString(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)

static void HOperatorSet.ReadString(HTuple windowHandle, HTuple inString, HTuple length, out HTuple outString)

string HWindow.ReadString(string inString, int length)

def read_string(window_handle: HHandle, in_string: str, length: int) -> str

描述

read_stringread_stringReadStringReadStringReadStringread_string reads a string with a predetermined maximum length (LengthLengthLengthLengthlengthlength) 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""filename_encoding""filename_encoding""filename_encoding""filename_encoding" is set to 'locale'"locale""locale""locale""locale""locale" with set_systemset_systemSetSystemSetSystemSetSystemset_system, the length is stated in number of bytes.

执行信息

参数

WindowHandleWindowHandleWindowHandleWindowHandlewindowHandlewindow_handle (输入控制)  window HWindow, HTupleHHandleHTupleHtuple (handle) (IntPtr) (HHandle) (handle)

窗口句柄。

InStringInStringInStringInStringinStringin_string (输入控制)  string HTuplestrHTupleHtuple (string) (string) (HString) (char*)

Default string (visible before input).

默认值: '' "" "" "" "" ""

LengthLengthLengthLengthlengthlength (输入控制)  integer HTupleintHTupleHtuple (integer) (int / long) (Hlong) (Hlong)

Maximum number of characters.

默认值: 32

限制: Length > 0 && Length <= 1024

OutStringOutStringOutStringOutStringoutStringout_string (输出控制)  string HTuplestrHTupleHtuple (string) (string) (HString) (char*)

Read string.

结果

read_stringread_stringReadStringReadStringReadStringread_string returns 2 ( H_MSG_TRUE) if the text window is valid and a string of maximal length fits within the right window boundary.否则将抛出异常。

可能的前趋

open_windowopen_windowOpenWindowOpenWindowOpenWindowopen_window, set_fontset_fontSetFontSetFontSetFontset_font

替代

read_charread_charReadCharReadCharReadCharread_char, fread_stringfread_stringFreadStringFreadStringFreadStringfread_string, fread_charfread_charFreadCharFreadCharFreadCharfread_char

另见

set_tpositionset_tpositionSetTpositionSetTpositionSetTpositionset_tposition, new_linenew_lineNewLineNewLineNewLinenew_line, open_windowopen_windowOpenWindowOpenWindowOpenWindowopen_window, set_fontset_fontSetFontSetFontSetFontset_font, set_colorset_colorSetColorSetColorSetColorset_color

模块

基础