FutureBasic Logo

<<    Index    >> FutureBasic

on appevent   statement



Syntax
on appevent fn userFunction

Description
This statement designates a particular function as an application event handling routine. An application event handling function is called in response to a variety of application notifications.

Note
If you use on appevent fn userFunction, then userFunction must refer to a function which was defined or prototyped at an earlier location in the source code. Your application event handling function should not return a result.

Example
This example assumes an application event handling function has been designated with the name "DoAppEvent" via a "on appevent fn DoAppEvent".

void local fn DoAppEvent( ev as long, obj as CFTypeRef )

select ( ev )
case _appWillFinishLaunching
... do something
case _appShouldTerminateAfterLastWindowClosed
AppEventSetBool(YES)
end select
end fn

App events
_appWillFinishLaunching
_appDidFinishLaunching
_appShouldTerminate
_appShouldTerminateAfterLastWindowClosed
_appWillTerminate
_appWillBecomeActive
_appDidBecomeActive
_appWillResignActive
_appDidResignActive
_appWillHide
_appDidHide
_appWillUnhide
_appDidUnhide
_appWillUpdate
_appDidUpdate
_appShouldHandleReopen
_appDockMenu
_appWillPresentError
_appDidChangeScreenParameters
_appOpenFileWithoutUI
_appOpenTempFile
_appOpenFiles
_appOpenUntitledFile
_appShouldOpenUntitledFile
_appPrintFile
_appPrintFiles
_appDidRegisterForRemoteNotificationsWithDeviceToken
_appDidFailToRegisterForRemoteNotifications
_appDidReceiveRemoteNotification
_appDidDecodeRestorableState
_appWillEncodeRestorableState
_appWillContinueUserActivityWithType
_appContinueUserActivity
_appDidFailToContinueUserActivityWithType
_appDidUpdateUserActivity
_appDidChangeOcclusionState
_appOpenURLs

App event functions
AppEventSetBool( BOOL value )
AppEventSetLong( long value )
AppEventString = CFStringRef
AppEventArray = CFArrayRef
AppEventDictionary = CFDictionaryRef
AppEventURL = CFURLRef
AppEventSetMenu( CocoaMenuRef m )
 
Apple documentation
NSApplicationDelegate