TAILIEUCHUNG - Mac OS X Programming phần 5

Đối số thứ tư, NULL, bỏ qua các bản ghi của các thông tin cảnh báo thêm. Đối số cuối cùng, cảnh báo, nói với CreateStandardAlert để tạo ra một cảnh báo rằng có thể sau đó được tham chiếu bằng cách sử dụng các cảnh báo biến DialogRef. Trước đó trong chương này, bạn đọc mô tả về các kiểu dữ liệu WindowRef. DialogRef | The nib file for this project requires two window resources. This example uses a document window and a utility window but you re free to change the window types. In the nib file the windows should be named MainWindow and InfoWindow . If you use different names you ll need to change the arguments to calls to CreateWindowFromNib to match your names. Both windows are empty. Their content will be created in window update routines in the source code. The program doesn t make use of any of the menu items so you can leave the menu bar resource unchanged. Example contains the entire listing for the example program. Here you see an example of the multiple window updating technique described in the previous section a global variable is declared for each of two window types and a single event handler is used to invoke the proper update routine for the window that needs to be redrawn. The code that comprises each update routine is similar to the code discussed in the previous example WindowUpdate. Example MultipleWindowUpdate Source Code include Carbon pascal OSStatus MyWindowEventHandler EventHandlerCallRef handlerRef EventRef event void userData void UpdateMainWindow void void UpdateInfoWindow void WindowRef gMainWindow WindowRef gInfoWindow int main int argc char argv IBNibRef nibRef OSStatus err EventTargetRef target EventHandlerUPP handlerUPP EventTypeSpec windowEvent kEventClassWindow kEventWindowDrawContent err CreateNibReference CFSTR main nibRef err SetMenuBarFromNib nibRef CFSTR MainMenu err CreateWindowFromNib nibRef CFSTR MainWindow gMainWindow target GetWindowEventTarget gMainWindow handlerUPP NewEventHandlerUPP MyWindowEventHandler InstallEventHandler target handlerUPP 1 windowEvent void gMainWindow NULL err CreateWindowFromNib nibRef CFSTR InfoWindow gInfoWindow target GetWindowEventTarget gInfoWindow handlerUPP NewEventHandlerUPP MyWindowEventHandler InstallEventHandler target handlerUPP 1 windowEvent void gInfoWindow NULL DisposeNibReference .

TỪ KHÓA LIÊN QUAN
TAILIEUCHUNG - Chia sẻ tài liệu không giới hạn
Địa chỉ : 444 Hoang Hoa Tham, Hanoi, Viet Nam
Website : tailieuchung.com
Email : tailieuchung20@gmail.com
Tailieuchung.com là thư viện tài liệu trực tuyến, nơi chia sẽ trao đổi hàng triệu tài liệu như luận văn đồ án, sách, giáo trình, đề thi.
Chúng tôi không chịu trách nhiệm liên quan đến các vấn đề bản quyền nội dung tài liệu được thành viên tự nguyện đăng tải lên, nếu phát hiện thấy tài liệu xấu hoặc tài liệu có bản quyền xin hãy email cho chúng tôi.
Đã 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.