previous chapter contents page top page next chapter


ConfirmationDialog

March 15, 1996

inherits from TitledWindow;

Class Description

Some Magic Cap user actions cause information to be lost, such as touching the clear button in the in box. By displaying a confirmation dialog, a window that asks the user to confirm the action, Magic Cap provides a way to double-check with the user before carrying out the requested operation. Magic Cap defines class ConfirmationDialog for this purpose.

Programming information

Instantiate: rarely
Subclass: rarely
Call its methods: rarely

You probably won't ever make your own confirmation dialogs. Instead, you'll probably use the standard confirmation dialog supplied by Magic Cap, customizing it by passing parameters to the operations that use it.

Methods defined by class ConfirmationDialog

Class ConfirmationDialog defines the following methods:

Method Description
Confirm Called when yes button is pressed.
Number Returns operation number called by yes button.
DeleteCurrentCardWithConfirmation Deletes current card with default text, image, and sound.
PerformWithConfirmation Call to show standard confirmation dialog.
PerformWithConfirmationFancy Call to show customized confirmation dialog.
AboutToShow Overridden to remove extraneous touches.
CanAccept Overridden to return false if writing or touch tool or no option key.
Hide Overridden to hide any identical copies of responder.
TypeKeys Overridden to provide keyboard shortcuts for yes and no.
AboutToHide Overridden to help save memory.
CanExtendBottom Overridden to always return true.
Notice Overridden to hide responder if target is destroyed.

Fields defined by class ConfirmationDialog

Class ConfirmationDialog 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
Inherited from Viewable
superview Viewable Container for this object
subview Viewable Object contained by this object
relativeOrigin Dot Origin relative to superview
contentSize Dot Size of content rectangle
viewFlags Flags Property settings
labelStyle TextStyle Text style of object's label
color Color Color of object's content
shadow Shadow Shadow drawn with object
sound Sound Sound associated with object
Inherited from HasBorder
border Border Framed border drawn around object
Inherited from Window
windowFlags Flags Stores various boolean attributes of the window
Inherited from TitledWindow
titleColor Unsigned RGB color for title box
titleHeight Micron Height of title box
dependents ObjectList List of dependent windows
Defined by ConfirmationDialog
promptField TextField Text for dialog prompt
target Object Object to call operation on for yes button
operationNumber OperationNumber Operation to call for yes button
operationParameter Unsigned Parameter to operation for yes button
sound Sound Sound to play for yes button
stamp Stamp Stamp showing caller image
yesButton Button Button to press for yes response
noButton Button Button to press for no response

Method Descriptions

Confirm

operation Confirm()
Call: rarely
Override: rarely

Magic Cap calls Confirm when the user touches the yes button. Confirm then calls the given operation on the target.

Number

attribute Number: OperationNumber, readOnly
// operation Number():OperationNumber
Call: rarely
Override: rarely

The attribute Number refers to the operation that will be called if the user touches the yes button.

DeleteCurrentCardWithConfirmation

operation DeleteCurrentCardWithConfirmation()
Call: sometimes
Override: rarely

You can delete the current card by calling DeleteCurrentCardWithConfirmation, which calls PerformWithConfirmation witha confirmation dialog that asks the user to confirm throwing away the current card.

PerformWithConfirmation

operation PerformWithConfirmation(prompt: Text; target: Object; 
operationNumber: OperationNumber; sound: Sound; image: Image; 
forceConfirm:  Boolean)
Call: sometimes
Override: rarely

You can use a confirmation dialog for a proposed action by calling PerformWithConfirmation. When you call PerformWithConfirmation, you specify the confirmation dialog, the text and image to show in the window, the sound to be played if the user touches the yes button, and the target object and proposed operation. For more information, see Magic Cap Concepts.

PerformWithConfirmationFancy

operation PerformWithConfirmationFancy(prompt: Text; target: Object; 
operationNumber: OperationNumber; sound: Sound; image: Image; 
parameter: Unsigned; buttonNames: Text; forceConfirm:  Boolean)
Call: sometimes
Override: rarely

If you want to customize the appearance and behavior of the confirmation dialog, you can call PerformWithConfirmationFancy. Fancy confirmation lets you customize standard dialogs by specifying different labels for the yes and no buttons and by proposing an operation that takes a parameter. For more information, see Magic Cap Concepts.

AboutToShow

overrides AboutToShow
Call: rarely
Override: sometimes

Class ConfirmationDialog overrides AboutToShow to flush leftover user touches before showing.

CanAccept

overrides CanAccept
Call: rarely
Override: sometimes

Class ConfirmationDialog overrides CanAccept to return false if the current tool is a writing or touch tool or if the option key is not down. Otherwise, CanAccept calls its inherited implementation.

Hide

overrides Hide
Call: rarely
Override: sometimes

Class ConfirmationDialog overrides Hide to remove any identical copies of the responder when it goes away.

TypeKeys

overrides TypeKeys
Call: rarely
Override: sometimes

Class ConfirmationDialog overrides TypeKeys to provide keyboard shortcuts for the yes and no buttons. The return and enter keys are shortcuts for the yes button, and the delete and esc keys are shortcuts for the no button. All other keys are rejected.

AboutToHide

overrides AboutToHide
Call: rarely
Override: sometimes

Class ConfirmationDialog overrides AboutToHide to return the confirmation dialog to its default state in order to save RAM by preventing shadowing.

CanExtendBottom

overrides CanExtendBottom
Call: rarely
Override: sometimes

Class ConfirmationDialog overrides CanExtendBottom to always return true.

Notice

overrides Notice
Call: rarely
Override: sometimes

Class ConfirmationDialog overrides Notice to hide the responder if the target is destroyed.