eXept Software AG Logo

Smalltalk/X Webserver

Documentation of class 'InfoBox':

Home

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

Class: InfoBox


Inheritance:

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

Package:
stx:libwidg
Category:
Views-DialogBoxes
Version:
rev: 1.56 date: 2017/12/01 10:57:31
user: cg
file: InfoBox.st directory: libwidg
module: stx stc-classLibrary: libwidg
Author:
Claus Gittinger

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 is going to
     be moved fully into Dialog, and the subclasses will 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.
 It has a single ok-Button, which closes the box.
 Also entering return has (by default) the same effect as pressing
 the ok-button.
 InfoBox is a superclass of some other boxes - see WarningBox, YesNoBox etc.
 most of them simply redefine the icon shown in the upper left or
 add buttons.

 [instance variables:]

     formLabel        <Label>        shows a bitmap (warning, question-mark)

     textLabel        <Label>        shows the boxes text


Class protocol:

defaults
o  defaultLabel
return the boxes default window title.

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  iconBitmapFromStyle: styleName orStyleFile: styleFile orFilename: fileName
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

image specs
o  iconWithAlpha
This resource specification was automatically generated
by the ImageEditor of ST/X.
usage example(s):
     self iconWithAlpha inspect
     ImageEditor openOnClass:self andSelector:#iconWithAlpha
     Icon flushCachedIcons

instance creation
o  title: titleString
create a new infoBox with title, aTitleString
usage example(s):
     (InfoBox title:'hello') open

o  title: titleString label: labelString
create a new infoBox with label, labelString
usage example(s):
     (InfoBox title:'hello' label:'Attention' ) open

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


Instance protocol:

accessing
o  form: aFormOrImage
historical leftover - define a form to be displayed left of the title

** This is an obsolete interface - do not use it (it may vanish in future versions) **

o  formLabel
return the formLabel = can be used to change its appearance

o  image: aForm
define a form to be displayed left of the title
- usually left as defaulted:
an exclamation-mark here, warn-sign in warningBox,
others in other subclasses.

o  textLabel
return the textLabel = can be used to change its appearance

o  title
return the boxes title string

o  title: aString
set the boxes label string

o  title: aString label: windowLabel
set the boxes label string

initialization
o  initFormBitmap
setup the bitmap shown in the upper left -
extracted into a separate method for easier redefinition
in subclasses

o  initFormLabel
setup the icon shown in the infoBox.
Can be redefined in subclasses.

o  initialize
must be called if redefined

queries
o  beepWhenOpening
Dialog information:'hello'
Dialog warn:'hello'
Dialog error:'hello'

o  preferredExtent
return my preferred extent
usage example(s):
If I have an explicit preferredExtent..
usage example(s):
If I have a cached preferredExtent value..


Examples:


Notice, the preferred use is via the DialogBox class messages, such as
    Dialog information:'Time to go home'
these (DialogBox) mesages are compatible with VW and should therefore be used for portability. Direct use of InfoBox is only required for highly specialized boxes. InfoBoxes are created with: aBox := InfoBox title:'some title'. and shown with: aBox showAtPointer or aBox open The default box shows 'yes' in its button; this can be changed with: aBox okText:'some string'. the boxes bitmap-image can be changed with: aBox image:aForm Since this type of information is pretty common, a convenient information method has been added to Object. Thus, you can use:
    self information:'hello world'
everwhere in your program. for ST-80 compatibility, you can also use:
    Dialog information:'hello world'
standard box:
    |box|

    box := InfoBox title:'hello world '.
    box open
changing the buttons label:
    |box|

    box := InfoBox title:'hello world '.
    box okText:'wow'.
    box open
changing the icon:
    |box|

    box := InfoBox title:'hello world '.
    box image:(Image fromFile:'libtool/bitmaps/SBrowser.xbm' inPackage:'stx:libtool').
    box okText:'wow'.
    box open
or even:
    |box|

    box := InfoBox title:'hello garfield '.
    box image:((Image fromFile:'garfield.gif' inPackage:'stx:goodies/bitmaps/gifImages') magnifiedTo:200@100).
    box okText:'wow'.
    box open
If you plan to use boxes as in the last example, you may want to keep the box around for reuse (since the image magnification takes some time).
    |box|

    box := InfoBox title:'hello garfield '.
    box image:((Image fromFile:'garfield.gif' inPackage:'stx:goodies/bitmaps/gifImages') magnifiedTo:200@100).
    box okText:'wow'.
    box open.

    box title:'hello again'.
    box open


ST/X 7.1.0.0; WebServer 1.663 at exept.de:8081; Sun, 22 Jul 2018 12:42:35 GMT