Legacy Documentclose button

Important: This document is part of the Legacy section of the ADC Reference Library. This information should not be used for new development.

Current information on this Reference Library topic can be found here:

Version: 1.0

Posted: 2003-01-30

Build Requirements: N/A

Runtime Requirements: Carbon

View Source Code:

Download Sample (“Sys7_popUpCDEF.zip”, 20.7K)
Download Sample (“Sys7_popUpCDEF.dmg”, 78.5K)


A simple example of using the PopupCDEF available in System 7 and later. This CDEF allows you to create and work with popup menus in windows and dialogs a lot more easily than in the past. You use the same code as for controls. You no longer have to seperate control clicks from PopupClicks, calling TrackControl does the 'InsertMenu/PopupMenuSelect/DeleteMenu' stuff for you. The popupCDEF also handles things like using the window font, adding a resource menu (like a font menu) and other things from within the resource definition, there is less code you have to put in your application. But some things have bitten folks, like making sure the tracking works correctly and the eternal question, "Where's the MenuHandle?". This sample shows those things. Look at the function DoDocumentClick to see how tracking and getting the value of a popup is done, and the function GetPopUpMenuHandle to see the proper way to access the MenuHandle of a popupCDEF popup menu. And of course, look at the Rez file (or look with ResEdit or your favorite resource editior) to see how the different popup setups are defined.

Document Revision History

Date Notes
2003-01-30First Version

Did this document help you?
Yes: Tell us what works for you.
It’s good, but: Report typos, inaccuracies, and so forth.
It wasn’t helpful: Tell us what would have helped.