Inherits from InfoWindow Inherits interface from BalloonSpout
Public address objects are windows used to display announcements. Some have balloon spouts and spout from a stamp in the name bar. Some contain controls and buttons. Others just display text.
Public addresses are most often used to present announcements. See the chapters on classes Announcement, StatusAnnouncement, and TargetedAnnouncement for more information.
See also the parent classes of class PublicAddress; in particular, see class InfoWindow.
To use some public address windows, read the text they display. Tap on the close box when you're done.
Other public address windows display the status of an ongoing task. You can hide these public addresses while you do other work.
Instantiate: sometimes Subclass: rarely Call its methods: rarely
You will probably never subclass PublicAddress or call any of its methods directly. You will just put public address objects into place in your object definition files, together with the announcements they'll be used to display.
You might not need to create your own public address window. The system defines several which you could use instead. They are:
Public address | Looks like this |
iSystemWarnings | |
iSystemAnnouncements | |
iStatusAnnouncements (for modal announcements that need to display progress) |
|
iCollectWindow (for status announcements) |
|
iTaskAlarmAnnouncement | |
iPhoneStatusWindow | |
iIncomingCallWindow | |
iBeamReceiveAnnouncement | |
iMainPowerPublicAddress | |
iBackupPowerPublicAddress |
While some of these public address windows are specialized, others are general. You'll use iSystemWarnings, iSystemAnnouncements, and iStatusAnnouncements quite often. Some of these windowssuch as any window with a status barare more appropriate for status announcements than for plain announcements. Below are examples of two public address windows that show you some of the more common uses.
Here's the system warnings window:
Instance PublicAddress 'System warnings' 298; // 92 bytes next: nilObject; previous: nilObject; superview: nilObject; subview: (TextField 719); relativeOrigin: <2.0,-100.0>; contentSize: <374.0,29.0>; viewFlags: 0x50004000; labelStyle: iBook12; color: 0xFF000000; altColor: -1; shadow: iShadowGray8; sound: nilObject; border: {120,76}; windowFlags: 0x00000001; titleColor: 0xFF333333; titleHeight: <0.0>; dependents: nilObject; balloonDot: <0.0,0.0>; target: nilObject; info: nilObject; currentTopic: nilObject; infoFields: (TextField 719); currentAnnouncement: nilObject; End Instance;
Most system warnings use this public address. This address has two subviews: a text field to display announcement text, and an animation of a blinking exclamation mark. Here's what this public address looks like when it displays a battery warning:
You should use this public address, or a very similar public address, to present your users with static announcements. If all you need to do is display text, use a plain announcement object with the iSystemWarnings public address.
You can add buttons, controls, and other viewables to your public address windows. Here's an example of a public address with interesting subviews:
Instance PublicAddress 'Collecting mail' 7000; next: nilObject; previous: nilObject; superview: nilObject; subview: (TextField 7001); relativeOrigin: <-32.0,-30.0>; contentSize: <356.0,78.0>; viewFlags: 0x50004000; labelStyle: iBook12Bold; color: 0xFF000000; altColor: -1; shadow: iShadowGray8; sound: nilObject; border: iBorderBlack2; windowFlags: 0x00000004; titleColor: 0xFF333333; titleHeight: <28.0>; dependents: nilObject; balloonDot: <0.0,0.0>; target: nilObject; info: (Text 9830); currentTopic: nilObject; infoFields: (TextField 7001); currentAnnouncement: nilObject; End Instance;
This public address looks like this:
This public address, iCollectWindow, contains a bar graph to display the progress of the task at hand, a stamp to show which service it's collecting mail from, and a simple action button which stops collecting. It also contains a text field which gives the user additional information about the progress of the collection. You probably won't use this particular public address, but you should use similar public addresses to give your users information about tasks in progress. If you need to display a status bar, use status announcements. Class StatusAnnouncement defines a method, UpdateStatusIndicator, which you can call to update the bar.
Create a fully custom public address for tasks that require specific controls or buttons other than a stop button. Just add the objects you need as subviews of the public address window.
Class PublicAddress defines the following methods:
Method | Description |
---|---|
Abort | Called when hitting stop button (if the public address has one) |
Overridden methods | |
ReplaceText | Calls PopulateTextFields to put announcement text into text field |
Disappear | Overridden to retract displayOnce announcements |
KeepFrontMost | Overridden to return true if the current announcement should stay frontmost |
PersistentWindow | Overridden to return true if the current announcement is urgent |
ShowInfoTopic | Overridden to set the window's topic and update text fields |
ZoomFromWhere | Overridden to turn off zooming |
BalloonDot | Overridden to turn off spouts for public addresses without title bars |
Class PublicAddress defines the following attributes:
Attribute | Type | Description |
---|---|---|
CurrentAnnouncement | Announcement | Associated with the currentAnnouncement field |
Class PublicAddress defines the following fields:
Field | Type | Description |
---|---|---|
Inherited from SingleLinkable: | ||
next | Object | Next item in view list |
Inherited from Linkable: | ||
previous | Object | Previous item in view list |
Defined by Viewable: | ||
superview | Viewable | Container for this object |
subview | Viewable | First object contained by this object |
relativeOrigin | Dot | Origin relative to superview |
contentSize | Dot | Size of content rectangle |
viewFlags | Unsigned | Property settings |
labelStyle | TextStyle | Text style of viewable's label |
color | Unsigned | Color of viewable's content |
altColor | Unsigned | Alternative color (not used by publicaddress) |
shadow | Shadow | Shadow drawn with object |
sound | Sound | Sound associated with object |
Inherited from HasBorder: | ||
border | Border | The window's border |
Inherited from Window: | ||
windowFlags | Flags | Window flags |
Inherited from TitledWindow: | ||
titleColor | Unsigned | The color of the title bar |
titleHeight | Micron | The height of the title bar |
dependents | ObjectList | The window's dependents, if any |
Inherited from BalloonSpout | ||
balloonDot | Dot | The balloon spout's origin |
Inherited from GadgetWindow: | ||
target | Object | The window's target |
Inherited from InfoTopic: | ||
info | Object | Text or list of viewables to display for this topic |
Inherited from InfoWindow: | ||
currentTopic | Object | Current topic with information being displayed |
infoFields | Object | A list of fields contained in the infowindow |
Defined by PublicAddress: | ||
currentAnnouncement | Announcement | Current announcement |
When you're creating your own public address windows, you should leave the currentAnnouncement, target, info, and currentTopic fields set to nilObject. Those fields are set on the fly by the system when it uses the public address to broadcast a specific announcement.
Make sure that the first subview of the public address is a text field. The methods of class PublicAddress assume that the first subview is a text field.
operation Abort(), noFail Call: rarely Override: rarely
The system calls this method when the user taps on the stop button, if the public address has one. PublicAddress_Abort passes along the abort to its current announcement.
operation ReplaceText(textToInsert: HasText), noFail Call: rarely Override: sometimes
Call ReplaceText to insert text from your announcement into the public address window.
If you need to update the text of the current announcement, you might want to call Announcement_ReplaceTextData instead. That method calls PublicAddress_ReplaceText.
PublicAddress_ReplaceText does nothing if the PublicAddress object is not on screen when ReplaceText is called. Subclass PublicAddress and override ReplaceText if you need to update the informational text while your public address is off-screen. To do so, you'd override this method using code something like this:
Method void PublicAddress_ReplaceText(ObjectID self, ObjectID newText) { PopulateTextFields(self, FirstSubview(self), newText); DirtyContent(self); }