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.74 date: 2024/02/13 14:39:34
user: stefan
file: InfoBox.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 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

copyright

COPYRIGHT (c) 1989 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
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 label string

o  title: aString
set the boxes label string

o  title: labelString label: windowTitleString
set the boxes label string

o  xxlabel

initialization
o  addHTMLView

o  addHTMLViewWith: htmlText

o  addHTMLViewWith: htmlText height: numPixelsOrNil
otherView width:1.0.

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

o  realize
(comment from inherited method)
if any inputFields were added, activate the first one

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

testing
o  isInfoOrWarningBox


Examples:


Notice, the preferred use is via the DialogBox class messages, such as
    Dialog information:'Time to go home'
these (DialogBox) messages 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:'smiley_cool.xpm' inPackage:'stx:goodies/bitmaps/xpmBitmaps/smileys').
    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.7.0.0; WebServer 1.702 at 20f6060372b9.unknown:8081; Thu, 21 Nov 2024 16:00:55 GMT