tailieunhanh - Beginning Linux Programming Third Edition phần 4

Sau khi sắp xếp cho sub_window_ptr để trỏ đến các kết quả của các cuộc gọi subwin, chúng tôi làm cho subwindow cuộn. Ngay cả sau khi subwindow đã được xóa và cửa sổ cơ sở (strdcr) được làm mới, các văn bản trên màn hình vẫn giữ nguyên. Điều này là bởi vì các subwindow đã thực sự cập nhật các dữ liệu nhân vật cho stdscr. | Managing Text-Based Screens with curses Figure 6-6 How It Works After arranging for the sub_window_ptr to point to the result of the subwin call we make the subwindow scrollable. Even after the subwindow has been deleted and the base window strdcr is refreshed the text on the screen remains the same. This is because the subwindow was actually updating the character data for stdscr. The Keypad You ve already seen some of the facilities that curses provides for handling the keyboard. Many keyboards have at the very least cursor keys and function keys. Many also have a keypad and other keys such as Insert and Home. Decoding these keys is a difficult problem on most terminals because they normally send a string of characters starting with the escape character. Not only does the application have the problem of distinguishing between a single press of the Escape key and a string of characters caused by pressing a function key but it must also cope with different terminals using different sequences for the same logical key. Fortunately curses provides an elegant facility for managing function keys. For each terminal the sequence sent by each of its function keys is stored normally in a terminfo structure and the include file has a set of defines prefixed by KEY_ that define the logical keys. The translation between the sequences and logical keys is disabled when curses starts and has to be turned on by the keypad function. If the call succeeds it returns OK otherwise ERR. 225 Chapter 6 include int keypad WINDOW window_ptr bool keypad_on Once keypad mode has been enabled by calling keypad with keypad_on set to true curses takes over the processing of key sequences so that reading the keyboard may now not only return the key that was pressed but also one of the KEY_ defines for logical keys. There are three slight restrictions when using keypad mode The recognition of escape sequences is timing-dependent and many network protocols will group characters .

crossorigin="anonymous">
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.