# Application

Application inherits from Object and defines instance variables nextToRun, widgets, widgetsByName, widgetsByID, menuActions. It has a subclass: MiniDebugger.

Application is an abstract superclass implementing the application framework. In general, each form in a Smalltalk program will correspond to one Application subclass.
Override the class-side method #formID to answer the resource ID of the form for the Application subclass. Override #createComponents to create bindings to PalmOS widgets (using #add:id:name:aspect:) and #createMenus to create bindings to menu options (using #addMenuAction:forID:).
To launch one Application from another, send #spawn: to the running application (self) with the application instance to jump to as an argument. Only use the class-side #show method for the top-level form.

## Methods defined in Application:

### Methods for accessing:

- nextToRun
- nextToRun: app
- widgetNamed: name
- widgetWithID: id

### Methods for control flow:

- eventLoop
- getNextEvent
  Answer true if event was handled by the system, false if the receiver should handle it.
- handleLastEvent

### Methods for event handling:

- eventTimeout
  May be overridden by subclasses that want to do 'polling' event loops.
- handleAppStopEvent
- handleControlEnterEvent
- handleControlExitEvent
- handleControlRepeatEvent
- handleControlSelectEvent
- handleDaySelectEvent
- handleFieldChangedEvent
- handleFieldEnterEvent
- handleFieldHeightChangedEvent
- handleFormCloseEvent
- handleFormGotoEvent
  only for special launch codes...
- handleFormLoadEvent
- handleFormOpenEvent
- handleFormSaveEvent
  No idea what this is for.
- handleFormTitleEnterEvent
- handleFormTitleSelectEvent
- handleFormUpdateEvent
  not really sure what this is supposed to do...
- handleKeyDownEvent
- handleListEnterEvent
- handleListExitEvent
- handleListSelectEvent
- handleMenuEvent
- handleNilEvent
- handlePenDownEvent
- handlePenMoveEvent
- handlePenUpEvent
- handlePopSelectEvent
- handleScrollbarEnterEvent
- handleScrollbarExitEvent
- handleScrollbarRepeatEvent
- handleTableEnterEvent
  Tables not implemented yet ...
- handleTableExitEvent
  Tables not implemented yet ...
- handleTableSelectEvent
  Tables not implemented yet ...
- handleWindowEnterEvent
- handleWindowExitEvent

### Methods for events:

- onKeyDown: key modifiers: modifiers
- onOpened
  Subclasses can override.
- onPenDownAt: position
- onPenMoveAt: position
- onPenUpAt: position
- onVirtualKeyDown: key modifiers: modifiers

### Methods for initialization:

- add: formObjectClass id: objectID name: objectName aspect: objectAspect
- addMenuAction: selector forID: menuID
- createComponents
  Subclasses override to create form objects.
- createMenus
  Forms with menus should override this to create the menu actions (using #addMenuAction:forID:).
- initialize
- initializeWidgets
- release
  Sent when the application 'terminates'; i.e., when another form is activated.
- releaseWidgets

### Methods for utility:

- clearDirty
- isDirty
- spawn: application
  Use this to launch one application from another, rather than Application class>>#show!

Pocket Smalltalk Documentation