tailieunhanh - BeginningMac OS X Tiger Dashboard Widget Development 2006 phần 5
Cắt, sao chép và dán là những thành phần quan trọng của bất kỳ ứng dụng Macintosh và là tinh túy Mac. Cũng giống như Clipboard của Finder, Bảng điều khiển có một bàn nhồi bột có thể được sử dụng để truyền dữ liệu. Khi bạn cắt, sao chép, và các chức năng dán widget của bạn, bạn cung cấp cho người sử dụng một cách dễ dàng để di chuyển dữ liệu giữa các ứng dụng và widget. | Widget Events System Resources As you saw earlier if your computer has been off or asleep the first time you activate Dashboard you may see all of your widgets without their preferences while the information is retrieved. This is a technique for conserving system resources while Dashboard isn t activated. You can see the impact widgets have on your system if you launch Activity Monitor and leave it running while Dashboard activates. CPU Disk Activity and Network usage all spike Figure 7-2 . To monitor widgets you will need to view All Processes in the Activity Monitor and filter for Dashboard because widgets run as children of Dashboard. Doing this allows you to see the widgets that are installed as well as their resource usage. During the initial spike when Dashboard activates they use the most CPU and bandwidth. Figure 7-2 117 Chapter 7 Once you close Dashboard however the widgets resource usage falls off aside from the real and virtual memory that they use Figure 7-3 . While Dashboard provides an environment for widgets it does not provide the memory space. Widgets run as child processes of the Dock and are listed individually in the BSD utility top and the Activity Monitor Figure 7-4 . You ll also notice when you look in Activity Monitor that Dashboard doesn t show up as a process. Figure 7-3 118 Widget Events Figure 7-4 Removing Widget Preferences As you noticed by looking in Activity Monitor at the resources used by widgets a widget that isn t installed in Dashboard doesn t use any resources. This means that you can lessen system impact by removing unused widgets from Dashboard. You may remember that when you remove a widget from Dashboard by clicking the close box it is not uninstalled or moved to the trash. It remains in the Widgets folder and visible in the Widgets tray until you need it again. Widget preferences also hang around unless you explicitly remove them. A removal event handler is available if you want to remove your widget s preferences whenever
đang nạp các trang xem trước