Important: The information in this document is obsolete and should not be used for new development.
Interacting With the User
When your application receives an Apple event, it may need to interact with the user. For example, it may need to display a dialog box asking the user for additional information or confirmation. You must use theAEInteractWithUserfunction to make sure your application is in the foreground before it actually interacts with the user.Both the client application and the server application specify their preferences for user interaction. The
AEInteractWithUserfunction checks the user interaction preferences set by each application. If both the client and the server allow user interaction,AEInteractWithUserusually posts a notification request, and the Notification Manager brings the server to the foreground after the user responds to the notification request.The
AEInteractWithUserfunction can also bring the server application directly to the foreground, but only if the client application is the active application on the same computer and has set two flags in thesendModeparameter of theAESendfunction: thekAEWaitReplyflag, which indicates that it is waiting for a reply, and thekAECanSwitchLayerflag, which indicates that it wants the server application to come directly to the foreground rather than posting a notification request.To specify its preferences for how the server application should interact with the user, the client application sets various flags in the
sendModeparameter toAESend. The Apple Event Manager sets the corresponding flags in thekeyInteractLevelAttrattribute of the Apple event.The server application sets its preferences with the
AESetInteractionAllowedfunction. This function lets your application specify whether it allows interaction with the user as a result of receiving an Apple event from itself; from itself and other processes on the local computer; or from itself, local processes, and processes from another computer on the network.Your application calls the
AEInteractWithUserfunction before interacting with the user. IfAEInteractWithUserreturns thenoErrresult code, then your application is currently in the front and free to interact with the user. IfAEInteractWithUserreturns theerrAENoUserInteractionresult code, the conditions didn't allow user interaction and your application should not interact with the user.The rest of this section explains how to set user interactions for the client and server applications and the practical effect these settings have when a server needs to interact with a user.
Subtopics
- Setting the Client Application's User Interaction Preferences
- Setting the Server Application's User Interaction Preferences
- Requesting User Interaction