TweetFollow Us on Twitter

MACINTOSH C

CHAPTER 14 - PART 2

Go to Contents

Radio Groups (Embedding Control)

Radio groups are embedder controls which relieve your application of much of the work involved in managing a group of radio buttons (or bevel buttons which are intended to operate like radio buttons). For example, if a group of radio buttons are embedded in a radio group control, the radio group control handles the checking and unchecking of the radio buttons when the user clicks on one of them. The current value of the radio group control represents the radio button currently selected.

Variant and Control Definition ID

The radio group CDEF resource ID is 26. The one available variant and its control definition ID is as follows:

Variant Var Code Control Definition ID
Radio group. 0 416 kControlRadioGroupProc

Control Values

Control Value Content
Initial Set to 0 on creation. Reset to the index of currently selected embedded radio control after creation. If the currently selected control does not support radio behaviour, this value will be set to 0 and the control will be deselected. To deselect all controls, set to 0.
Minimum Set to 0.
Maximum Set to 0 on creation. Reset to the number of embedded controls as controls are added.

Control Part Codes

Constant Value Description
kControlRadioGroupPart 27 Event occurred in a radio group.



Asynchronous Arrows

Asynchronous arrows (see Fig 15) are a simple animation used to indicate that an asynchronous background process is occurring, in other words a process which does not display a dialog box containing a progress indicator. Asynchronous arrows are also known as "chasing arrows".

(Asynchronous arrows)

Variant and Control Definition ID

The asynchronous arrows CDEF resource ID is 7. The one available variant and its control definition ID is as follows:

Variant Var Code Control Definition ID
Asynchronous arrows. 0 112 kControlChasingArrowsProc

Control Values

Control Value Content
Initial Reserved. Set to 0.
Minimum Reserved. Set to 0.
Maximum Reserved. Set to 0.



User Panes (Embedding Control)

The user pane has two main uses:

  • It can be used as an embedder control, that is, other controls may be embedded within it. It is thus particularly useful for grouping together the controls belonging to an individual pane of a tab control or pop-up button group box.

  • It provides a way to hook in application-defined functions, known as user pane functions (see below), which perform actions such as drawing, hit testing, tracking, etc.

Variants and Control Definition IDs

The user pane CDEF resource ID is 16. The one available variant and its control definition ID is as follows:

Variant Var Code Control Definition ID
User pane. 0 256 kControlUserPaneProc

Control Values

Control Value Content
Initial One or more of the control feature constants. (See Defining Your Own User Pane Functions, below.) Reset to 0 after creation.
Minimum Ignored. After user pane creation, reset to a setting between -32768 to 32768.
Maximum Ignored. After user pane creation, reset to a setting between -32768 to 32768.

Control Data Tag Constants

The control data tag constants relevant to user panes all relate to user pane functions. See Defining Your Own User Pane Function, below.

Scrolling Text Box (Embedding Control)

The scrolling text box implements a scrolling box of non-editable text. This is useful for credits in About boxes, etc. There are two variants:

  • The standard variant, which has a scroll bar.

  • The auto-scrolling variant, which does not have a scroll bar. This variant needs two pieces of information to work: the delay (in ticks) before the scrolling starts; the time (in ticks) between scrolls. By default, the text will scroll one pixel at a time, although this may be changed via SetControlData.

Variants and Control Definition IDs

The scrolling text box CDEF resource ID is27. The two available variants and their control definition IDs are as follows:

Variant Var Code Control Definition ID
Standard. 0 432 kControlScrollTextBoxProc
Auto-scrolling. 1 433 kControlScrollTextBoxAutoScrollProc

Control Values

Control Value Content
Initial Resource ID of a 'TEXT' and, optionally, a 'styl' resource.
Minimum For the standard variant, set to 0.

For the auto-scrolling variant , the delay (in ticks) before scrolling begins. (This delay is also used between when the scrolling completes and when it begins again.)

Maximum For the standard variant, set to 0.

For the auto-scrolling variant, the delay (in ticks) between each unit of scrolling.

Control Data Tag Constant Meaning and Data Type Returned or Set
KControlScrollTextBoxDelayBefore AutoScrollTag Gets or sets the number of ticks of delay before the initial scrolling of an auto-scrolling text box begins.

Data type returned or set: UInt32

KControlScrollTextBoxDelay BetweenAutoScrollTag Gets or sets the number of ticks of delay between each unit of scrolling in an auto-scrolling text box.

Data type returned or set: UInt32

KControlScrollTextBoxAutoScroll AmountTag Gets or sets the number of pixels by which an auto scrolling text box scrolls. (The default is 1.)

Data type returned or set: UInt16

kControlScrollTextBoxContentsTag Sets the ID of a 'TEXT' resource and, optionally, a 'styl' resource, to be used as the content of a standard or auto-scrolling text box.

Data type returned or set: Sint16



Idle Processing

The following four controls need to perform idle processing for the reasons indicated:

Control Reason For Idle Processing
Progress Indicator (indeterminate variant). Animate the indicator.
Clocks (when the kControlClockIsLive clock value flag constant is used). Update the clock.
Asynchronous arrows. Animate the arrows.
Edit text control. Cause TextEdit to be called to blink the insertion point caret.

When these controls are displayed in a document window, your application should call the IdleControls function at least once in your event loop. IdleControls sends a particular message to the CDEF, which responds appropriately.

Defining Your Own Key Filter Function

Controls that support text input (such as edit text control and list box controls) can attach an application-defined key filter function to filter key strokes or modify them on return. . Your key filter function can change the keystroke, leave it alone, or block the CDEF from receiving it. For example, an edit text control could use a key filter function to allow only numeric values to be input in its field.

The Control Manager declares the type for an application-defined key filter function as follows:

     typedef CALLBACK_API(ControlKeyFilterResult,ControlKeyFilterProcPtr)
                          (ControlHandle theControl,SInt16 *keyCode,SInt16 *charCode,
                          SInt16 *modifiers);

The Control Manager defines the data type ControlKeyFilterUPP to identify the universal procedure pointer for this application-defined function:

     typedef STACK_UPP_TYPE(ControlKeyFilterProcPtr) ControlKeyFilterUPP; 

As stated at Edit Text Fields, above, the control data tag constant for getting and setting a key filter function is kControlKeyFilterTag and the data type returned or set is ControlKeyFilterUPP.

Example

The following example relates to an edit text control and assumes an application-defined key filter function named numericFilter.

     #define kLeftArrow   0x1C
     #define kRightArrow  0x1D
     #define kUpArrow     0x1E
     #define kDownArrow   0x1F
     #define kBackspace   0x08
     ...

     ControlKeyFilterUPP  numericFilterUPP;
     ControlHandle        controlHdl;
     ...

     // ....................................................... create routine descriptor

     numericFilterUPP = NewControlKeyFilterProc(numericFilter);

     // ....................................... attach key filter function to the control

     GetDialogItemAsControl(dialogPtr,itemNumber,&controlHdl);
     SetControlData(controlHdl,kControlNoPart,kControlEditTextKeyFilterTag,
                    sizeof(numericFilterUPP),(Ptr) &numericFilterUPP);

     ...

     // ××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××× numericFilter
     //
     // This function will be called each time the edit text control receives a keystroke.
     // Keystrokes that are to be accepted must return kControlKeyFilterPassKey.  
     // Keystrokes that are to be blocked must return kControlKeyFilterBlockKey.  This 
     // function blocks all but the numeric keys, the "dash" key, and the arrow keys.

     pascal ControlKeyFilterResult numericFilter(ControlHandle control,SInt16* keyCode,
                                                 SInt16 *charCode,SInt16 *modifiers)
     {
       if(((char) *charCode >= '0') && ((char) *charCode <= '9'))
         return kControlKeyFilterPassKey;
  
       switch(*charCode)
       {
         case '-':
         case kLeftArrow:
         case kRightArrow:
         case kUpArrow:
         case kDownArrow:
         case kBackspace:
           return kControlKeyFilterPassKey;
           break;

         default:
           SysBeep(10);
           return kControlKeyFilterBlockKey;
           break;
       }
     }

Defining Your Own Edit Text Validation Function

A key filter function, however, does not cater for the case of pasting text to an edit text item. Accordingly, you will ordinarily want to combine an edit text validation function with the key filter function for a specific edit text control. The following example ensures that, if a user supplied filename pasted to the edit text item contains one or more colons, those colons will be replaced with dashes.
     ControlEditTextValidationUPP editTextValidatorUPP;
     ControlHandle                controlHdl;
...

     // ....................................................... create routine descriptor

     editTextValidatorUPP = NewControlEditTextValidationProc(editTextValidator); 

     // ............................. attach edit text validation function to the control

     GetDialogItemAsControl(dialogPtr,iEditText1,&controlHdl);
     SetControlData(controlHdl,kControlNoPart,kControlEditTextValidationProcTag,
                    sizeof(editTextValidatorUPP),(Ptr) &editTextValidatorUPP);
     ...

     pascal void  editTextValidator(ControlHandle controlHdl)
     {
       Str31  theText;
       Size   actualSize;
       UInt8  a;

       // ................................. Get the text to be examined from the control

       GetControlData(controlHdl,kControlNoPart,kControlEditTextTextTag,
                      sizeof(theText) -1,(Ptr) &theText[1],&actualSize);

       // ............................................ Set the length byte to the number
       // ...... of characters in the text, limited to the current maximum for filenames

       if(actualSize <= 31)
         theText[0] = actualSize;
       else
         theText[0] = 31;

       // ............................................... Replace any colons with dashes

       for(a=1;a<=theText[0];a++)
       {
         if(theText[a] == ':')
           theText[a] = '-';
       }

       // .............................................. You might want to add code here
       //  here to check whether any characters were replaced before bothering to redraw

       // ................ Put the replaced text into the control and redraw the control

       SetControlData(controlHdl,kControlNoPart,kControlEditTextTextTag,theText[0],
                      (Ptr) &theText[1]);

       Draw1Control(controlHdl);
     }

Defining Your Own User Pane Functions

As previously stated, one of the functions of a user pane is to provide a way to hook in application-defined functions which perform actions such as drawing, hit testing, tracking, etc. Such application-defined functions are called user pane functions.

User pane functions provide you with the ability to create a custom Appearance-compliant control without writing your own control definition function.

Once you have provided a user pane function, you call SetControlData with the control data tag constant representing the user pane function you wish to get or set passed in the inTagName parameter and a universal procedure pointer to the user pane function passed in the inData parameter.

User Pane Functions

User pane functions are categorised as follows:

Function Description
Draw Draws the content of a user pane control in the rectangle of user pane control.
Hit test Returns the part code of the control that the point was in when the mouse-down event occurred.
Tracking Tracks a control while the user holds down the mouse button. The function should track the control by repeatedly calling the action function specified in the actionProc parameter until the mouse button is released. When the mouse button is released, your function should return the part code of the control part that was tracked.

This function will only get called if you have set the kControlHandlesTracking control feature bit on creation of the user pane control.

Idle Performs idle processing.

This function will only get called if you have set the kControlWantsIdle control feature bit on creation of the user pane control.

Key Down Handles keyboard event processing. The function should handle the key pressed or released by the user and return the part code of the control where the keyboard event occurred.

This function will only get called if you've set the kControlSupportsFocus control feature bit on creation of the user pane control.

Activate Handles activate and deactivate event processing. The function should perform any special processing before the user pane becomes activated or deactivated. For example, it should deactivate its TEHandle or ListHandle if the user pane is about to be deactivated.

This function will only get called if you have set the kControlWantsActivate control feature bit on creation of the user pane control.

Focus Handle keyboard focus. The function is called in response to a change in keyboard focus. It should respond by changing keyboard focus based on the part code passed in the action parameter.

This function will only get called if you have set the kControlSupportsFocus control feature bit on creation of the user pane control.

Background Sets the background colour or pattern (only for user panes that support embedding). The function should set the user pane background colour or pattern to whatever is appropriate given the bit depth and device type passed in.

This function will only get called if you have set the kControlHasSpecialBackground and kControlSupportsEmbedding control feature bits on creation of the user pane control.

Control Feature Flags

As stated at User Panes, above, the initial value of a user pane is one or more of the control feature constants. As stated in the preceding list of user pane functions, certain user pane functions will only get called if certain control feature flags are set. The control feature flags relevant to user pane functions are as follows:

     KControlSupportsEmbedding     = 1 << 1,
     KControlSupportsFocus         = 1 << 2,
     KControlWantsIdle             = 1 << 3,
     KControlWantsActivate         = 1 << 4,
     KControlHandlesTracking       = 1 << 5,
     KControlHasSpecialBackground  = 1 << 7,

Type Definitions

The Control Manager declares the following types for user pane functions:

     typedef CALLBACK_API(void,ControlUserPaneDrawProcPtr) 
                         (ControlHandle control,SInt16 part);

     typedef CALLBACK_API(ControlPartCode,ControlUserPaneHitTestProcPtr)
                         (ControlHandle control,Point where);

     typedef CALLBACK_API(ControlPartCode,ControlUserPaneTrackingProcPtr)
                         (ControlHandle control,Point startPt,
                         ControlActionUPP actionProc);

     typedef CALLBACK_API(void,ControlUserPaneIdleProcPtr)
                         (ControlHandle control);

     typedef CALLBACK_API(ControlPartCode,ControlUserPaneKeyDownProcPtr)
                         (ControlHandle control,SInt16 keyCode, SInt16 charCode,
                          SInt16 modifiers);

     typedef CALLBACK_API(void,ControlUserPaneActivateProcPtr)
                         (ControlHandle control,Boolean activating);

     typedef CALLBACK_API(ControlPartCode,ControlUserPaneFocusProcPtr)
                         (ControlHandle control,ControlFocusPart action);

     typedef CALLBACK_API(void,ControlUserPaneBackgroundProcPtr)
                         (ControlHandle control, ControlBackgroundPtr info);

The Control Manager defines the following data types to identify the universal procedure pointer for user pane functions:

  typedef STACK_UPP_TYPE(ControlUserPaneDrawProcPtr)       ControlUserPaneDrawUPP;
  typedef STACK_UPP_TYPE(ControlUserPaneHitTestProcPtr)    ControlUserPaneHitTestUPP;
  typedef STACK_UPP_TYPE(ControlUserPaneTrackingProcPtr)   ControlUserPaneTrackingUPP;
  typedef STACK_UPP_TYPE(ControlUserPaneIdleProcPtr)       ControlUserPaneIdleUPP;
  typedef STACK_UPP_TYPE(ControlUserPaneKeyDownProcPtr)    ControlUserPaneKeyDownUPP;
  typedef STACK_UPP_TYPE(ControlUserPaneActivateProcPtr)   ControlUserPaneActivateUPP;
  typedef STACK_UPP_TYPE(ControlUserPaneFocusProcPtr)      ControlUserPaneFocusUPP;
  typedef STACK_UPP_TYPE(ControlUserPaneBackgroundProcPtr) ControlUserPaneBackgroundUPP;

Control Data Tag Constants

The control data tag constants relating to user pane functions are as follows:

Control Data Tag Constant Meaning and Data Type Returned or Set
kControlUserPaneDrawProcTag Gets or sets a user pane drawing function. Indicates that the Control Manager needs to draw a control.

Data type returned or set: ControlUserPaneDrawingUPP

kControlUserPaneHitTestProcTag Gets or sets a user pane hit-testing function. Indicates that the Control Manager needs to determine if a control part was hit.

Data type returned or set: ControlUserPaneHitTestUPP

kControlUserPaneTrackingProcTag Gets or sets a user pane tracking function, which will be called when a control definition function returns the kControlHandlesTracking feature bit in response to a kControlMsgGetFeatures message. Indicates that a user pane handles its own tracking.

Data type returned or set: ControlUserPaneTrackingUPP

kControlUserPaneIdleProcTag Gets or sets a user pane idle function, which will be called when a control definition function returns the kControlWantsIdle feature bit in response to kControlMsgGetFeatures message. Indicates that a user pane performs idle processing.

Data type returned or set: ControlUserPaneIdleUPP

kControlUserPaneKeyDownProcTag Gets or sets a user pane key down function, which will be called when a control definition function returns the kControlSupportsFocus feature bit in response to a kControlMsgGetFeatures message. Indicates that a user pane performs keyboard event processing.

Data type returned or set: ControlUserPaneKeyDownUPP

kControlUserPaneActivateProcTag Gets or sets a user pane activate function, which will be called when a control definition function returns the kControlWantsActivate feature bit in response to a kControlMsgGetFeatures message. Indicates that a user pane wants to be informed of activate and deactivate events.

Data type returned or set: ControlUserPaneActivateUPP

kControlUserPaneFocusProcTag Gets or sets a user pane keyboard focus function, which will be called when a control definition function returns the kControlSupportsFocus feature bit in response to a kControlMsgGetFeatures message. Indicates that a user pane handles keyboard focus.

Data type returned or set: ControlUserPaneFocusUPP

kControlUserPaneBackgroundProcTag Gets or sets a user pane background function, which will be called when a control definition function returns the kControlHasSpecialBackground and kControlSupportsEmbedding feature bits in response to a kControlMsgGetFeatures message. Indicates that a user pane can set its background colour or pattern.

Data type returned or set: ControlUserPaneBackgroundUPP



Main Constants, Data Types and Functions

All of the following constants, data types, and functions, with the exception of some of the control part code constants, were introduced with Mac OS 8 and the Appearance Manager. Those introduced with Mac OS 8.5 appear in dark blue.

Constants

Control Definition IDs

KControlBevelButtonSmallBevelProc         = 32
KControlBevelButtonNormalBevelProc        = 33
KControlBevelButtonLargeBevelProc         = 34
kControlSliderProc                        = 48
kControlSliderLiveFeedback                = (1 << 0)
kControlSliderHasTickMarks                = (1 << 1)
kControlSliderReverseDirection            = (1 << 2)
kControlSliderNonDirectional              = (1 << 3)
kControlTriangleProc                      = 64
kControlTriangleLeftFacingProc            = 65
kControlTriangleAutoToggleProc            = 66
kControlTriangleLeftFacingAutoToggleProc  = 67
kControlProgressBarProc                   = 80
kControlLittleArrowsProc                  = 96
kControlChasingArrowsProc                 = 112
kControlTabLargeProc                      = 128
kControlTabSmallProc                      = 129
kControlSeparatorLineProc                 = 144
kControlGroupBoxTextTitleProc             = 160
kControlGroupBoxCheckBoxProc              = 161
kControlGroupBoxPopupButtonProc           = 162
kControlGroupBoxSecondaryTextTitleProc    = 164
kControlGroupBoxSecondaryCheckBoxProc     = 165
kControlGroupBoxSecondaryPopupButtonProc  = 166
kControlImageWellProc                     = 176
kControlPopupArrowEastProc                = 192
kControlPopupArrowWestProc                = 193
kControlPopupArrowNorthProc               = 194
kControlPopupArrowSouthProc               = 195
kControlPopupArrowSmallEastProc           = 196
kControlPopupArrowSmallWestProc           = 197
kControlPopupArrowSmallNorthProc          = 198
kControlPopupArrowSmallSouthProc          = 199
kControlPlacardProc                       = 224
kControlClockTimeProc                     = 240
kControlClockTimeSecondsProc              = 241
kControlClockDateProc                     = 242
kControlClockMonthYearProc                = 243
kControlUserPaneProc                      = 256
kControlEditTextProc                      = 272
kControlEditTextDialogProc                = 273
kControlEditTextPasswordProc              = 274
kControlEditTextInlineInputProc           = 276
kControlStaticTextProc                    = 288
kControlPictureProc                       = 304
kControlPictureNoTrackProc                = 305
kControlIconProc                          = 320
kControlIconNoTrackProc                   = 321
kControlIconSuiteProc                     = 322
kControlIconSuiteNoTrackProc              = 323
kControlIconRefProc                       = 324
kControlIconRefNoTrackProc                = 325
kControlWindowHeaderProc                  = 336
kControlWindowListViewHeaderProc          = 337
kControlListBoxProc                       = 352
kControlListBoxAutoSizeProc               = 353
kControlRadioGroupProc                    = 416
kControlScrollTextBoxProc                 = 432
kControlScrollTextBoxAutoScrollProc       = 433

Control Variants

kControlNoVariant                     = 0
kControlUsesOwningWindowsFontVariant  = 1 << 3

Control Part Codes

kControlNoPart                  = 0
kControlLabelPart               = 1
kControlMenuPart                = 2
kControlTrianglePart            = 4
kControlEditTextPart            = 5
kControlPicturePart             = 6
kControlIconPart                = 7
kControlClockPart               = 8
kControlClockHourDayPart        = 9,
kControlClockMinuteMonthPart    = 10
kControlClockSecondYearPart     = 11
kControlClockAMPMPart           = 12
kControlListBoxPart             = 24
kControlListBoxDoubleClickPart  = 25
kControlImageWellPart           = 26
kControlRadioGroupPart          = 27
kControlButtonPart              = 10
kControlCheckBoxPart            = 11
kControlRadioButtonPart         = 11
kControlUpButtonPart            = 20
kControlDownButtonPart          = 21
kControlPageUpPart              = 22
kControlPageDownPart            = 23
kControlIndicatorPart           = 129
kControlDisabledPart            = 254
kControlInactivePart            = 255

Bevel Button Graphic Alignment

KControlBevelButtonAlignSysDirection  = -1
KControlBevelButtonAlignCenter        = 0
KControlBevelButtonAlignLeft          = 1
KControlBevelButtonAlignRight         = 2
KControlBevelButtonAlignTop           = 3
kControlBevelButtonAlignBottom        = 4
kControlBevelButtonAlignTopLeft       = 5
kControlBevelButtonAlignBottomLeft    = 6
kControlBevelButtonAlignTopRight      = 7
kControlBevelButtonAlignBottomRight   = 8

Bevel Button Text Alignment values

KControlBevelButtonAlignTextSysDirection  = teFlushDefault
KControlBevelButtonAlignTextCenter        = teCenter
KControlBevelButtonAlignTextFlushRight    = teFlushRight
KControlBevelButtonAlignTextFlushLeft     = teFlushLeft

Bevel Button Text Placement

KControlBevelButtonPlaceSysDirection      = -1
KControlBevelButtonPlaceNormally          = 0
KControlBevelButtonPlaceToRightOfGraphic  = 1
KControlBevelButtonPlaceToLeftOfGraphic   = 2
KControlBevelButtonPlaceBelowGraphic      = 3
KControlBevelButtonPlaceAboveGraphic      = 4

Bevel Button Behaviour

kControlBehaviorPushbutton      = 0
kControlBehaviorToggles         = 0x0100
kControlBehaviorSticky          = 0x0200
kControlBehaviorMultiValueMenu  = 0x4000
kControlBehaviorOffsetContents  = 0x8000
kControlBehaviorCommandMenu     = 0x2000

Bevel Button Content Type

kControlContentTextOnly         = 0
kControlContentIconSuiteRes     = 1
kControlContentCIconRes         = 2
kControlContentPictRes          = 3
kControlContentIconSuiteHandle  = 129
kControlContentCIconHandle      = 130
kControlContentPictHandle       = 131
kControlContentIconRef          = 132

Clock Value Flag Constants

kControlClockNoFlags        = 0
kControlClockIsDisplayOnly  = 1
kControlClockIsLive         = 2

Control Data Tags

kControlFontStyleTag                    = FOUR_CHAR_CODE('font')
kControlKeyFilterTag                    = FOUR_CHAR_CODE('fltr')
kControlBevelButtonContentTag           = FOUR_CHAR_CODE('cont')
kControlBevelButtonTransformTag         = FOUR_CHAR_CODE('tran')
kControlBevelButtonTextAlignTag         = FOUR_CHAR_CODE('tali')
kControlBevelButtonTextOffsetTag        = FOUR_CHAR_CODE('toff')
kControlBevelButtonGraphicAlignTag      = FOUR_CHAR_CODE('gali')
kControlBevelButtonGraphicOffsetTag     = FOUR_CHAR_CODE('goff')
kControlBevelButtonTextPlaceTag         = FOUR_CHAR_CODE('tplc')
kControlBevelButtonMenuValueTag         = FOUR_CHAR_CODE('mval')
kControlBevelButtonMenuHandleTag        = FOUR_CHAR_CODE('mhnd')
kControlBevelButtonCenterPopupGlyphTag  = FOUR_CHAR_CODE('pglc')
kControlBevelButtonLastMenuTag          = FOUR_CHAR_CODE('lmnu')
kControlBevelButtonMenuDelayTag         = FOUR_CHAR_CODE('mdly')
kControlBevelButtonScaleIconTag         = FOUR_CHAR_CODE('scal')
kControlTriangleLastValueTag            = FOUR_CHAR_CODE('last')
kControlProgressBarIndeterminateTag     = FOUR_CHAR_CODE('inde')
kControlTabContentRectTag               = FOUR_CHAR_CODE('rect')
kControlTabEnabledFlagTag               = FOUR_CHAR_CODE('enab')
kControlTabFontStyleTag                 = kControlFontStyleTag
kControlGroupBoxMenuHandleTag           = FOUR_CHAR_CODE('mhan')
kControlGroupBoxFontStyleTag            = kControlFontStyleTag
kControlImageWellContentTag             = FOUR_CHAR_CODE('cont')
kControlImageWellTransformTag           = FOUR_CHAR_CODE('tran')
kControlClockLongDateTag                = FOUR_CHAR_CODE('date')
kControlClockFontStyleTag               = kControlFontStyleTag
kControlUserItemDrawProcTag             = FOUR_CHAR_CODE('uidp')
kControlUserPaneDrawProcTag             = FOUR_CHAR_CODE('draw')
kControlUserPaneHitTestProcTag          = FOUR_CHAR_CODE('hitt')
kControlUserPaneTrackingProcTag         = FOUR_CHAR_CODE('trak')
kControlUserPaneIdleProcTag             = FOUR_CHAR_CODE('idle')
kControlUserPaneKeyDownProcTag          = FOUR_CHAR_CODE('keyd')
kControlUserPaneActivateProcTag         = FOUR_CHAR_CODE('acti')
kControlUserPaneFocusProcTag            = FOUR_CHAR_CODE('foci')
kControlUserPaneBackgroundProcTag       = FOUR_CHAR_CODE('back')
kControlEditTextStyleTag                = kControlFontStyleTag
kControlEditTextTextTag                 = FOUR_CHAR_CODE('text')
kControlEditTextTEHandleTag             = FOUR_CHAR_CODE('than')
kControlEditTextKeyFilterTag            = kControlKeyFilterTag,
kControlEditTextSelectionTag            = FOUR_CHAR_CODE('sele')
kControlEditTextPasswordTag             = FOUR_CHAR_CODE('pass')
kControlEditTextLockedTag               = FOUR_CHAR_CODE('lock')
kControlEditTextValidationProcTag       = FOUR_CHAR_CODE('vali')
kControlStaticTextStyleTag              = kControlFontStyleTag
kControlStaticTextTextTag               = FOUR_CHAR_CODE('text')
kControlStaticTextTextHeightTag         = FOUR_CHAR_CODE('thei')
kControlStaticTextTruncTag              = FOUR_CHAR_CODE('trun')
kControlIconTransformTag                = FOUR_CHAR_CODE('trfm')
kControlIconAlignmentTag                = FOUR_CHAR_CODE('algn')
kControlIconResourceIDTag               = FOUR_CHAR_CODE('ires')
kControlIconContentTag                  = FOUR_CHAR_CODE('cont')
kControlListBoxListHandleTag            = FOUR_CHAR_CODE('lhan')
kControlListBoxKeyFilterTag             = kControlKeyFilterTag
kControlListBoxFontStyleTag             = kControlFontStyleTag
kControlListBoxDoubleClickTag           = FOUR_CHAR_CODE('dblc')
kControlScrollTextBoxDelayBeforeAutoScrollTag  = FOUR_CHAR_CODE('stdl')
kControlScrollTextBoxDelayBetweenAutoScrollTag = FOUR_CHAR_CODE('scdl')
kControlScrollTextBoxAutoScrollAmountTag       = FOUR_CHAR_CODE('samt')
kControlScrollTextBoxContentsTag               = FOUR_CHAR_CODE('tres')

Key Filter Result Codes

kControlKeyFilterBlockKey  = 0
kControlKeyFilterPassKey   = 1

Control Feature Bits

kControlSupportsGhosting      = 1 << 0
kControlSupportsEmbedding     = 1 << 1
kControlSupportsFocus         = 1 << 2
kControlWantsIdle             = 1 << 3
kControlWantsActivate         = 1 << 4
kControlHandlesTracking       = 1 << 5
kControlSupportsDataAccess    = 1 << 6
kControlHasSpecialBackground  = 1 << 7
kControlGetsFocusOnClick      = 1 << 8
kControlSupportsCalcBestRect  = 1 << 9
kControlSupportsLiveFeedback  = 1 << 10
kControlHasRadioBehavior      = 1 << 11

Focusing Part Codes

KcontrolFocusNoPart    = 0
KControlFocusNextPart  = -1
kControlFocusPrevPart  = -2

Data Types

typedef SInt16 ControlFocusPart;
typedef SInt16 ControlKeyFilterResult;
typedef SInt16 ControlButtonGraphicAlignment;
typedef SInt16 ControlButtonTextAlignment;
typedef SInt16 ControlButtonTextPlacement;
typedef SInt16 ControlContentType;
typedef SInt16 ControlVariant;

Bevel Button and Image Well Content Structure

struct ControlButtonContentInfo 
{
  ControlContentType   contentType;
  union 
  {
    SInt16       resID;
    CiconHandle  cIconHandle;
    Handle       iconSuite;
    Handle       iconRef;
    PicHandle    picture;
  } u;
};
typedef struct ControlButtonContentInfo ControlButtonContentInfo;
typedef ControlButtonContentInfo *ControlButtonContentInfoPtr;

Edit Text Selection Structure

struct ControlEditTextSelectionRec
{
  SInt16   selStart;
  SInt16   selEnd;
};
typedef struct ControlEditTextSelectionRec ControlEditTextSelectionRec;
typedef ControlEditTextSelectionRec *  ControlEditTextSelectionPtr;

Tab Information Structure

struct ControlTabInfoRec
{
  SInt16  version;
  SInt16  iconSuiteID;
  Str255  name;
};

User Pane Functions

typedef CALLBACK_API(void,ControlUserPaneDrawProcPtr) 
                    (ControlHandle control,SInt16 part);

typedef CALLBACK_API(ControlPartCode,ControlUserPaneHitTestProcPtr)
                    (ControlHandle control,Point where);

typedef CALLBACK_API(ControlPartCode,ControlUserPaneTrackingProcPtr)
                    (ControlHandle control,Point startPt,ControlActionUPP actionProc);

typedef CALLBACK_API(void,ControlUserPaneIdleProcPtr)
                    (ControlHandle control);

typedef CALLBACK_API(ControlPartCode,ControlUserPaneKeyDownProcPtr)
                    (ControlHandle control,SInt16 keyCode, SInt16 charCode,
                     SInt16 modifiers);

typedef CALLBACK_API(void,ControlUserPaneActivateProcPtr)
                    (ControlHandle control,Boolean activating);

typedef CALLBACK_API(ControlPartCode,ControlUserPaneFocusProcPtr)
                    (ControlHandle control,ControlFocusPart action);

typedef CALLBACK_API(void,ControlUserPaneBackgroundProcPtr)
                    (ControlHandle control, ControlBackgroundPtr info);

Universal Procedure Pointer Types For User Pane Functions

typedef STACK_UPP_TYPE(ControlUserPaneDrawProcPtr)       ControlUserPaneDrawUPP;
typedef STACK_UPP_TYPE(ControlUserPaneHitTestProcPtr)    ControlUserPaneHitTestUPP;
typedef STACK_UPP_TYPE(ControlUserPaneTrackingProcPtr)   ControlUserPaneTrackingUPP;
typedef STACK_UPP_TYPE(ControlUserPaneIdleProcPtr)       ControlUserPaneIdleUPP;
typedef STACK_UPP_TYPE(ControlUserPaneKeyDownProcPtr)    ControlUserPaneKeyDownUPP;
typedef STACK_UPP_TYPE(ControlUserPaneActivateProcPtr)   ControlUserPaneActivateUPP;
typedef STACK_UPP_TYPE(ControlUserPaneFocusProcPtr)      ControlUserPaneFocusUPP;
typedef STACK_UPP_TYPE(ControlUserPaneBackgroundProcPtr) ControlUserPaneBackgroundUPP;

Functions

Give Idle Time To Controls

void  IdleControls(WindowPtr inWindow)

Send Keyboard Event to Control With keyboard Focus

Sint16  HandleControlKey(ControlHandle inControl,SInt16 inKeyCode,SInt16 inCharCode,
        SInt16 inModifiers);

Set the Background For a Control

OSErr  SetUpControlBackground (ControlHandle inControl,SInt16 inDepth,
       Boolean inIsColorDevice);

KeyBoard Focus

OSErr  GetKeyboardFocus(WindowPtr inWindow,ControlHandle *outControl);
OSErr  SetKeyboardFocus(WindowPtr inWindow,ControlHandle inControl,
       ControlFocusPart inPart); 
OSErr  AdvanceKeyboardFocus(WindowPtr inWindow);
OSErr  ReverseKeyboardFocus(WindowPtr inWindow);
OSErr  ClearKeyboardFocus(WindowPtr inWindow);  

Control Features

OSErr  GetControlFeatures(ControlHandle inControl,UInt32 *outFeatures);

Validating Controls

Boolean IsValidControlhandle(Controlhandle theControl);

Control List

#define  GetControlListFromWindow(theWindow)
         (*(ControlHandle *) (((UInt8 *) theWindow) + sizeof(GrafPort) + 0x20))
#define  GetControlOwningWindowControlList(theWindow)
         (*(ControlHandle *) (((UInt8 *) theWindow) + sizeof(GrafPort) + 0x20))

Routine Descriptors - User Pane Functions

#define  NewControlUserPaneDrawProc(userRoutine)
         (ControlUserPaneDrawUPP)NewRoutineDescriptor((ProcPtr)(userRoutine),
         uppControlUserPaneDrawProcInfo, GetCurrentArchitecture())
#define  NewControlUserPaneHitTestProc(userRoutine) 
         (ControlUserPaneHitTestUPP)NewRoutineDescriptor((ProcPtr)(userRoutine),
         uppControlUserPaneHitTestProcInfo, GetCurrentArchitecture())
#define  NewControlUserPaneTrackingProc(userRoutine)
         (ControlUserPaneTrackingUPP)NewRoutineDescriptor((ProcPtr)(userRoutine),
         uppControlUserPaneTrackingProcInfo, GetCurrentArchitecture())
#define  NewControlUserPaneIdleProc(userRoutine) 
         (ControlUserPaneIdleUPP)NewRoutineDescriptor((ProcPtr)(userRoutine),
         uppControlUserPaneIdleProcInfo, GetCurrentArchitecture())
#define  NewControlUserPaneKeyDownProc(userRoutine)  
         (ControlUserPaneKeyDownUPP)NewRoutineDescriptor((ProcPtr)(userRoutine),
         uppControlUserPaneKeyDownProcInfo, GetCurrentArchitecture())
#define  NewControlUserPaneActivateProc(userRoutine) 
         (ControlUserPaneActivateUPP)NewRoutineDescriptor((ProcPtr)(userRoutine),
         uppControlUserPaneActivateProcInfo, GetCurrentArchitecture())
#define  NewControlUserPaneFocusProc(userRoutine)
         (ControlUserPaneFocusUPP)NewRoutineDescriptor((ProcPtr)(userRoutine),
         uppControlUserPaneFocusProcInfo, GetCurrentArchitecture())
#define  NewControlUserPaneBackgroundProc(userRoutine)
         (ControlUserPaneBackgroundUPP)NewRoutineDescriptor((ProcPtr)(userRoutine),
         uppControlUserPaneBackgroundProcInfo, GetCurrentArchitecture())

Go to Demo

 

Community Search:
MacTech Search:

Software Updates via MacUpdate

Latest Forum Discussions

See All

Combo Quest (Games)
Combo Quest 1.0 Device: iOS Universal Category: Games Price: $.99, Version: 1.0 (iTunes) Description: Combo Quest is an epic, time tap role-playing adventure. In this unique masterpiece, you are a knight on a heroic quest to retrieve... | Read more »
Hero Emblems (Games)
Hero Emblems 1.0 Device: iOS Universal Category: Games Price: $2.99, Version: 1.0 (iTunes) Description: ** 25% OFF for a limited time to celebrate the release ** ** Note for iPhone 6 user: If it doesn't run fullscreen on your device... | Read more »
Puzzle Blitz (Games)
Puzzle Blitz 1.0 Device: iOS Universal Category: Games Price: $1.99, Version: 1.0 (iTunes) Description: Puzzle Blitz is a frantic puzzle solving race against the clock! Solve as many puzzles as you can, before time runs out! You have... | Read more »
Sky Patrol (Games)
Sky Patrol 1.0.1 Device: iOS Universal Category: Games Price: $1.99, Version: 1.0.1 (iTunes) Description: 'Strategic Twist On The Classic Shooter Genre' - Indie Game Mag... | Read more »
The Princess Bride - The Official Game...
The Princess Bride - The Official Game 1.1 Device: iOS Universal Category: Games Price: $3.99, Version: 1.1 (iTunes) Description: An epic game based on the beloved classic movie? Inconceivable! Play the world of The Princess Bride... | Read more »
Frozen Synapse (Games)
Frozen Synapse 1.0 Device: iOS iPhone Category: Games Price: $2.99, Version: 1.0 (iTunes) Description: Frozen Synapse is a multi-award-winning tactical game. (Full cross-play with desktop and tablet versions) 9/10 Edge 9/10 Eurogamer... | Read more »
Space Marshals (Games)
Space Marshals 1.0.1 Device: iOS Universal Category: Games Price: $4.99, Version: 1.0.1 (iTunes) Description: ### IMPORTANT ### Please note that iPhone 4 is not supported. Space Marshals is a Sci-fi Wild West adventure taking place... | Read more »
Battle Slimes (Games)
Battle Slimes 1.0 Device: iOS Universal Category: Games Price: $1.99, Version: 1.0 (iTunes) Description: BATTLE SLIMES is a fun local multiplayer game. Control speedy & bouncy slime blobs as you compete with friends and family.... | Read more »
Spectrum - 3D Avenue (Games)
Spectrum - 3D Avenue 1.0 Device: iOS Universal Category: Games Price: $2.99, Version: 1.0 (iTunes) Description: "Spectrum is a pretty cool take on twitchy/reaction-based gameplay with enough complexity and style to stand out from the... | Read more »
Drop Wizard (Games)
Drop Wizard 1.0 Device: iOS Universal Category: Games Price: $1.99, Version: 1.0 (iTunes) Description: Bring back the joy of arcade games! Drop Wizard is an action arcade game where you play as Teo, a wizard on a quest to save his... | Read more »

Price Scanner via MacPrices.net

Deal Alert! Mac Studio with M4 Max CPU on sal...
B&H Photo has the standard-configuration Mac Studio model with Apple’s M4 Max CPU in stock today and on sale for $300 off MSRP, now $1699 (10-Core CPU and 32GB RAM/512GB SSD). B&H also... Read more

Jobs Board

All contents are Copyright 1984-2011 by Xplain Corporation. All rights reserved. Theme designed by Icreon.