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.60 date: 2019/07/16 13:06:25
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  label
(comment from inherited method)
return the view's name in the title area

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

o  title
return the boxes label string

o  title: aString
return the boxes label string

o  title: labelString label: windowTitleString
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'


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.2.0.0; WebServer 1.670 at bd0aa1f87cdd.unknown:8081; Fri, 29 Mar 2024 12:40:30 GMT