eXept Software AG Logo

Smalltalk/X Webserver

Documentation of class 'WarningBox':

Home

Documentation
www.exept.de
Everywhere
for:
[back]

Class: WarningBox


Inheritance:

   Object
   |
   +--GraphicsMedium
      |
      +--DisplaySurface
         |
         +--SimpleView
            |
            +--View
               |
               +--TopView
                  |
                  +--StandardSystemView
                     |
                     +--ModalBox
                        |
                        +--DialogBox
                           |
                           +--InfoBox
                              |
                              +--WarningBox
                                 |
                                 +--YesNoBox

Package:
stx:libwidg
Category:
Views-DialogBoxes
Version:
rev: 1.40 date: 2022/07/08 06:27:31
user: cg
file: WarningBox.st directory: libwidg
module: stx stc-classLibrary: libwidg

Description:


Historic note:
     originally, ST/X had separate classes for the various entry methods;
     there were YesNoBox, EnterBox, InfoBox and so on.
     In the meantime, the DialogBox class (and therefore its alias: Dialog)
     is going to duplicate most functionality found in these classes.

     In the future, those existing subclasses' functionality might
     be moved fully into Dialog, and the subclasses be replaced by dummy
     delegators. (They will be kept for backward compatibility, though).



 this class implements a pop-up box to show an information message.
 WarningBoxes are basically InfoBoxes with a different bitmap-image.
 (also, they add a beep when popping up)

 They are created with:

     aBox := WarningBox title:'some title'.

 and shown with:

     aBox showAtPointer

 The default box shows 'yes' in its button; this can be changed with:

     aBox okText:'some string'.

 Since showing warnings is a common action, a convenient method has been
 added to Object; thus you can use:

     self warn:'oops - headcrash'

 everywhere in your code.

copyright

COPYRIGHT (c) 1993 by Claus Gittinger All Rights Reserved This software is furnished under a license and may be used only in accordance with the terms of that license and with the inclusion of the above copyright notice. This software may not be provided or otherwise made available to, or used by, any other person. No title to or ownership of the software is hereby transferred.

Class protocol:

defaults
o  defaultLabel
(comment from inherited method)
return the boxes default window title.

icon bitmap
o  errorIconBitmap
return the bitmap shown as icon in my instances.
This is the default image; you can overwrite this in a concrete
instance with the image: message

Usage example(s):

     |box|

     box := WarningBox title:'foo bar'.
     box image:(WarningBox errorIconBitmap).
     box showAtPointer.

o  iconBitmap
return the bitmap shown as icon in my instances.
This is the default image; you can overwrite this in a concrete
instance with the image: message

o  warnIconBitmap
return the bitmap shown as icon in my instances.
This is the default image; you can overwrite this in a concrete
instance with the image: message

styles
o  updateStyleCache
extract values from the styleSheet and cache them in class variables.
Here, the cached infoBitmap is simply flushed.


Instance protocol:

queries
o  beepWhenOpening
(comment from inherited method)
Dialog information:'hello'
Dialog warn:'hello'
Dialog error:'hello'

testing
o  isWarningBox


Examples:


Notice, the preferred use is via the DialogBox class messages, such as
    Dialog warn:'Attention !'
these (DialogBox) messages are compatible with VW and should therefore be used for portability. Direct reference to WarnBox is only required for highly specialized boxes. standard warning dialogs (recommended, since these are ST-80 compatible interfaces)
    Dialog warn:'you should not do this'
since all objects support the #warn message, you can also simply use (for any self):
    self warn:'you should not do this'
with attributed text:
    Dialog warn:(Text string:'you should not do this'
                      emphasis:#color->Color red)
specifying more details of the warnBox (low level entries). label of OK-button:
    |aBox|

    aBox := WarningBox title:'Press ''OK'' to continue'.
    aBox okText:'OK'.
    aBox showAtPointer.
accessing the ok-Button component and changing its color:
    |aBox|

    aBox := WarningBox title:'Do you really want to do this ?'.
    aBox okText:'yes, go on'.
    aBox okButton foregroundColor:Color red.
    aBox showAtPointer.
since warnboxes are much like infoBoxes, all of look can be changed like described there:
    |image aBox|

    aBox := WarningBox title:'Press ''OK'' to continue'.
    aBox okText:'yes, continue'.
    image := Image fromFile:'bitmaps/SmalltalkX.xbm' inPackage:'stx:libtool'.
    aBox form:image.
    aBox showAtPointer.


ST/X 7.7.0.0; WebServer 1.702 at 20f6060372b9.unknown:8081; Mon, 18 Nov 2024 06:54:02 GMT