Function

CFUserNotificationCreate

Creates a CFUserNotification object and displays its notification dialog on screen.

Declaration

CFUserNotificationRef CFUserNotificationCreate(CFAllocatorRef allocator, CFTimeInterval timeout, CFOptionFlags flags, SInt32 *error, CFDictionaryRef dictionary);

Parameters

allocator

The allocator to use to allocate memory for the new object. Pass NULL or kCFAllocatorDefault to use the current default allocator.

timeout

The time to wait before the notification dialog dismisses itself if the user does not respond. If 0, the notification never times out.

flags

A set of flags describing the type of notification to display. These flags specify an alert level for the notification (see Alert Levels), determine whether radio buttons or checkboxes are to be used (see Button Flags), specify which, if any, of these buttons are checked by default (see CFUserNotificationCheckBoxChecked), specify whether any of the text fields are to be secure text fields (see CFUserNotificationSecureTextField), and determine which element of a pop-up menu, if present, should be selected by default (see CFUserNotificationPopUpSelection). Combine these flags together by performing a bitwise-OR operation with all the individual flags.

error

On return contains an integer error code. If 0, the user notification was successfully created and displayed.

dictionary

A description of the elements to display in the notification dialog. The possible keys are listed in Dialog Description Keys. The dictionary must contain a value for the key kCFUserNotificationAlertHeaderKey, but the other keys are optional.

Return Value

The new CFUserNotification object. Ownership follows the The Create Rule.

See Also

CFUserNotification Miscellaneous Functions

CFUserNotificationCancel

Cancels a user notification dialog.

CFUserNotificationCheckBoxChecked

Returns a flag used to set or test a checkbox’s state.

CFUserNotificationCreateRunLoopSource

Creates a run loop source for a user notification.

CFUserNotificationDisplayAlert

Displays a user notification dialog and waits for a user response.

CFUserNotificationDisplayNotice

Displays a user notification dialog that does not need a user response.

CFUserNotificationGetResponseDictionary

Returns the dictionary containing all the text field values from a dismissed notification dialog.

CFUserNotificationGetResponseValue

Extracts the values of the text fields from a dismissed notification dialog.

CFUserNotificationGetTypeID

Returns the type identifier for the CFUserNotification opaque type.

CFUserNotificationPopUpSelection

Returns a flag used to set the selected element of a pop-up menu.

CFUserNotificationReceiveResponse

Waits for the user to respond to a notification or for the notification to time out.

CFUserNotificationSecureTextField

Returns a flag used to set the secure state of a text field.

CFUserNotificationUpdate

Updates a displayed user notification dialog with new user interface information.