tailieunhanh - MASTERING DELPHI 6 phần 4

Sản lượng một cách cẩn thận định dạng của chương trình có thể bị hủy hoại bởi sự thay thế chữ. Vì lý do này, bạn có thể chỉ nên dựa trên chuẩn của Windows phông chữ (chẳng hạn như MS Sans Serif, hệ thống, Arial, Times New Roman, và như vậy | The ActionManager Architecture 317 OnGetItem VirtualListActionlGetltem OnGetItemCount VirtualListActionlGetltemCount OnItemSelected ListActionItemSelected end object ListControlCopySelectionl TListControlCopySelection Caption Copy Destination ListBox2 ListControl ListBox1 end object ListControlDeleteSelection1 TListControlDeleteSelection Caption Delete end object ListControlMoveSelection2 TListControlMoveSelection Caption Move Destination ListBox2 ListControl ListBox1 end end The program has also two list boxes in its form used as action targets. The Copy and Move actions are tied to these two list boxes by their ListControl and Destination properties. The Delete action instead automatically works with the list box having the input focus. The StaticListAction defines a series of alternative items in its Items collection. This is not a plain string list as any item has also an ImageIndex which allows turning the combo box in graphical selection. You can of course add more items to this list programmatically. However in case of a highly dynamic list you can also use the VirtualListAction. This component doesn t define a list of items but has two events you can use to provide strings and images for the list. The OnGetItemCount event allows you to indicate the number of items to display the OnGetItem event is then called for each specific item. In the ListActions demo the VirtualListAction has the following event handlers for its definition producing the list you can see in the active combo box of Figure procedure Sender TCustomListAction var Count Integer begin Count 100 end procedure Sender TCustomListAction const Index Integer var Value String var ImageIndex Integer var Data Pointer begin Value Item IntToStr Index end Copyright 2001 SYBEX Inc. Alameda CA 318 Chapters Building the User Interface FIGURE The ListActions application has a toolbar hosting a static list and a .

TỪ KHÓA LIÊN QUAN