eXept Software AG Logo

Smalltalk/X Webserver

Documentation of class 'ModalBox':

Home

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

Class: ModalBox


Inheritance:

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

Package:
stx:libview
Category:
Views-Basic
Version:
rev: 1.122 date: 2019/07/16 13:06:06
user: cg
file: ModalBox.st directory: libview
module: stx stc-classLibrary: libview
Author:
Claus Gittinger

Description:


this class implements modal boxes; ModalBoxes are different from
others, in that they take control over the current topview, until
all processing is done (i.e. the currently active topview and all of
its subviews will not handle user events while the box is active).

ModalBoxes are either implemented as transient windows
(if UseTransientViews := true) or as override redirect views.
Some window managers have problems with either; so you may want to
change the default setting from your display.rc file.


Related information:

    StandardSystemView
    DialogBox
    [introduction to view programming]

Class protocol:

defaults
o  defaultExtent
this defines the defaultExtent for instances of me;
the value returned here is usually not correct for concrete subclasses,
so you better redefine this method.
The value returned here is usually ignored, and
the value from preferredExtent taken instead.

o  defaultLabel
return the boxes default window title.

o  updateStyleCache
extract values from the styleSheet and cache them in class variables

usage example(s):

     self updateStyleCache

o  useTransientViews: aBoolean
change the way modalBoxes are created on the Display.
If the argument is true, transient views are used;
otherwise override redirect views are used.
Depending on your windowmanager, either one may have problems.
You may want to change the setting
from your display.rc or d_xxx.rc file.
This is now obsolete - transient views work and are always used.

usage example(s):

     ModalBox useTransientViews:false
     ModalBox useTransientViews:true

initialization
o  initialize
UseTransientViews := false


Instance protocol:

accessing
o  escapeIsCancel
return the escapeIsCancel setting - defaults to true for modalMox here.

o  exclusiveKeyboard: aBoolean
set/clear exclusive locking of the keyboard;
If set, the box will take total control over the
keyboard, not allowing input to other views/boxes
while active.
DANGER:
only use this for very very urgent boxes, since
no interaction with ANY view on the screen is possible then.

o  windowTitle

o  windowTitle: windowTitleString
set the boxes window title string

event handling
o  coveredBy: aView
the receiver has been covered by another view.
If the other view is a non-modal one, raise

o  terminate
this is the close from a windowmanager
(only if UseTransientViews == true)

o  visibilityChange: how
raise when covered - this should not be needed, since we
have been created as override-redirect window (which should
stay on top - but some window managers (fvwm) seem to ignore
this ...

o  xxxpointerEnter: state x: x y: y
mhmh: this seems to be a special X kludge;
without the following, we will not regain input focus after
pointer is reentered.

initialization & release
o  addToCurrentProject
ignored here

o  create

o  destroy
destroy the view.
redefined to also destroy my shadow, if there is one,
and to release the global keyboard grab (if there is one)

o  initEvents
initialize event handling; redefined to enable visibility changes

o  initStyle
setup viewStyle specifics

o  initialize
must be called if redefined

o  isPopUpView
return true, if I want to come up without decoration
and popUp to top immediately.

o  realize
(comment from inherited method)
must clear this flag

o  reinitialize
if I have already been reinited - return

usage example(s):

super reinitialize.

o  resize
resize myself to make everything visible

o  resizeUnderPointer
resize myself to make everything visible, AND possibly change the origin
to have the mouse pointer stay within my bounds.
This is used for self-resizing enterBoxes, to avoid moving
the box away from the cursor.

move & resize
o  doMove
the move button was pressed.
This method is only used with non-transient views
(UseTransientViews == false).

o  doResize
the resize button was pressed.
This method is only used with non-transient views
(UseTransientViews == false).

queries-internal
o  windowLabelFor: labelString
dialogs do not include the hostname in the window label

o  windowStyle
return a symbol describing my style (one of: #dialog, #popUp or #normal)
(may be used internally by the device as a decoration hint)

show & hide
o  autoHideAfter: seconds with: anAction
install a background process, which hides the box
after some time. Also, if non-nil, anAction will be
evaluated then. The action will not be evaluated if
the box is closed by the user pressing a button.

o  fixSize
this is sent right before the modalBox is made visible;
If the size is not fixed, adjust my size.

o  hide
make the receiver invisible and leave control

usage example(s):

         this is a kludge for IRIS and others which do not provide backingstore:
         when we hide a modalbox (such as a searchbox) which covered
         a scrollbar, the scrollbars bitblt-method will copy from the
         not-yet redrawn area - effectively clearing the scroller.
         We need a short delay here, since at this time, the expose event has
         not yet arrived.

o  hideRequest
hide request from windowGroup (i.e. via Escape key).
Can be redefined in subclasses which don't like this

o  mapped
wait till visible for grabbing

o  open
default for modalboxes is to come up modal at the pointer position

o  openAt: aPoint
default for modalboxes is to come up modal at the pointer position

o  openAtCenter
default for modalboxes is to come up modal at the pointer position

o  openModal: aBlock
open the box modal;
In addition to the basic (inherited) modalloop, possibly show a shadow.
(these days, the shadow-view is usually disabled, as modern graphics do it now for us)
Stay in the modal loop while aBlock evaluates to true AND the receiver is visible.
(i.e. control is returned to the sender when the receiver is closed)
This makes any interaction with the current window impossible -
however, other views (in other windowgroups) still work.

o  show
make myself visible (at the last or default position) and take control.
If that position is out of the screen area, moves the receiver to make
it fully visible.

o  showAt: aPoint
make myself visible at aPoint.
Fix position to make box fully visible

o  showAt: aPoint center: center
make myself visible at aPoint. center specifies
if the view should show up centered around aPoint.

o  showAt: aPoint centerX: centerX centerY: centerY
make myself visible at aPoint. centerX/centerY specify
if the view should show up centered around aPoint.
Fix position to make box fully visible

o  showAtCenter
make myself visible at the screen center.

o  showAtPointer
make myself visible at mouse pointer shifted to have
convenient button under cursor. self positionOffset should
return that offset (usually redefined, since we don't know here,
which button should be under cursor).

o  showAtPointerNotCovering: aView
make myself visible at mouse pointer shifted to have
convenient button under cursor.
Fix position to make the box fully visible AND to make sure that
aView is not covered.

o  showCenteredIn: aView
make myself visible at the center if aView.

o  unmapped
mhmh - unmapped by the windowManager - if realized (i.e. not closing),
keep the realized flag true (to avoid exiting the modal event loop).
Consider this a kludge.



ST/X 7.2.0.0; WebServer 1.670 at bd0aa1f87cdd.unknown:8081; Fri, 29 Mar 2024 14:54:02 GMT