[comp.sys.mac.programmer] Popup CDEF

han@apple.COM (Byron Han, Project Scapegoat) (12/21/89)

In article <898@excelan.COM> brianb@kinetics.com (Brian Bulkowski) writes:
> On a different note, anyone got some sample code that a tool can use
> to do pop up menus with the CommTB? Why isn't it in the manual how
> a tool creates and deals with pop up menus (arg, arg, bad doc)? There's
> some helpful stuff in the new code somewhere, but sometimes I can be
> dense.

Any application can use the popup CDEF (not just connection/terminal/file 
transfer tools).

It is CDEF 63 with appropriate variation codes as defined in the 
documentation.  Also, when the control is created, the values specified as 
parameters to NewControl or in the template for GetNewControl for the 
control minimum, maximum, value, and refcon take on special meanings.

On page 173 of the preliminary draft of the CommToolbox documentation 
(that went out with 1.0b2 of the software through APDA) in the Comm 
Toolbox Utilities section, there is a description of these fields.

contrlValue - controls how the popup label/title is displayed (stylistic 
variations plus justification in the popup label/title area)

contrlMin - resource ID of the menu to be "popped" up

contrlMax - width of the popup title/label area

procID - variation code plus CDEF ID * 16 (as per Control Manager 
specifications)
variation codes
1 - constant control width - do not dynamically resize popup control if 
the menu resizes.  Text will be truncated and ellipsized as appropriate
2 - use color QD if available.  If there are mctb's in the system they 
will be used.  If the control owner is a classic grafport and not a color 
grafport, the popup CDEF will create and destroy a color grafport to draw 
the colors without the annoying conversion to classic QD colors
4 - use the control refcon field as a resource type to do an AddResMenu to 
the menu
8 - use the window's font and size for drawing the popup control in its 
quiescent state as well as for drawing the menu.

Hope this helps...

+-------------------------------------------------------------------------+
| Disclaimer: Apple has no connection with my postings.                   |
+-------------------------------------------------------------------------+
Byron Han, CommToolbox Designer  "DeAnza 3 - R.I.P. - 10/17/89 5:04PM"
Apple Computer, Inc.              --------------------------------
20525 Mariani Ave, MS 69L         Internet: han@apple.COM
Cupertino, CA 95014               UUCP:{sun,voder,nsc,decwrl}!apple!han
--------------------------------  GENIE:BYRONHAN   CompuServe:72167,1664
ATTnet: 408-974-6450              Applelink:HAN1   HAN1@applelink.apple.COM
---------------------------------------------------------------------------