Đang chuẩn bị nút TẢI XUỐNG, xin hãy chờ
Tải xuống
Tham khảo tài liệu 'programming the be operating system-chapter 6: controls and messages', công nghệ thông tin, hệ điều hành phục vụ nhu cầu học tập, nghiên cứu và làm việc hiệu quả | In this chapter Introduction to Controls Buttons Picture Buttons Checkboxes Radio Buttons Text Fields Multiple Control Example Project 6 Controls and Messages A control is a graphic image that resides in a window and acts as a device that accepts user input. The BeOS API includes a set of classes that make it easy to add certain predefined controls to a program. These standard controls include the button checkbox radio button text field and color control. There s also a Be-defined class that allows you to turn any picture into a control. That allows you to create controls that have the look of real-world devices such as switches and dials. Chapter 5 Drawing described the color control and the BColorControl class used to create such controls. This chapter discusses other control types and the classes used to create each. Also discussed is the BControl class the class from which all other control classes are derived. When the user clicks on a control the system responds by sending a message to the window that holds the control. This message indicates exactly which control has been clicked. The message is received by the window s MessageReceived hook function where it is handled. Since the BWindow version of MessageReceived won t know how to go about responding to messages that originate from your controls you ll override this routine. Your application then gains control of how such messages are handled and can include any code necessary to carry out the task you want the control to perform. This chapter includes examples that demonstrate how to create controls and how to override MessageReceived such that the function handles mouse clicks on controls of any of the standard types. Introduction to Controls When a BWindow object receives a message it either handles the message itself or lets one of its views handle it. To handle a message the window invokes a BWindow hook function. For example a B_ZOOM message delivered to a window 177 178 Chapter 6 Controls and .