Apress Pro PHP-GTK phần 5

GtkTable là một lớp container được thiết kế đặc biệt để đặt ra một ứng dụng, không giống như HTML, được thiết kế để tổ chức dữ liệu. GtkTable có thể được sử dụng để dễ dàng hiển thị các vật dụng trong các hàng và cột. Một thùng chứa GtkTable là tương tự như một bảng trong HTML. Nó có các hàng và cột của các tế bào cá nhân, và mỗi tế bào có thể chiều dài hơn một hàng và / hoặc cột | 138 CHAPTER 7 DISPLAYING AND COLLECTING SIMPLE DATA values using a GtkEntry widget. This can lead to some very messy data input. There is no guarantee that the users of an application know how to spell Saskatchewan. Fortunately you can help users supply the correct data. GtkEntryCompletion is an object that can be associated with a GtkEntry. It tries to match what the user is typing to a predefined list of suggested values as shown in Figure 7-6. Using a GtkEntryCompletion object can help to reduce the number of errors entered by the user. GtkEntryCompletion is a helper object not a widget. It makes no sense to think of a GtkEntryCompletion without an associated GtkEntry. GtkEntryCompletion is not an end-all solution. It guides the users in the right direction when entering text but does not force them to pick one of the suggested values. You should use it when there is a set of likely values for a GtkEntry field but the set of possible values is not finite. The data that is taken from the GtkEntry field must still be checked for invalid values or characters especially if the data is to be inserted into a database. Figure 7-6. GtkEntryCompletion in action GtkEntryCompletion provides a list of suggested values using a GtkListStore. We ll take a closer look at GtkListStore in Chapter 9. For now you just need to know that GtkListStore is a list of data values and is the main support behind GtkEntryCompletion. Listing 7-6 shows the code that adds the GtkEntryCompletion to the stateEntry of ContributorEdit. Listing 7-6. Creating and Associating a GtkEntryCompletion Object php private function _layoutTool . Help the user out with the state by using a GtkEntryCompletion. stateCompletion new GtkEntryCompletion stateCompletion- set_model self createStateList stateCompletion- set_text_column 0 this- stateEntry- set_completion stateCompletion stateCompletion- set_inline_completion true . CHAPTER 7 DISPLAYING AND COLLECTING SIMPLE DATA 139 public static function .

Không thể tạo bản xem trước, hãy bấm tải xuống
TỪ KHÓA LIÊN QUAN
TÀI LIỆU MỚI ĐĂNG
91    78    5    21-05-2024
5    67    2    21-05-2024
100    125    8    21-05-2024
Đã 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.