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.135 date: 2022/02/17 18:28:46
user: cg
file: ModalBox.st directory: libview
module: stx stc-classLibrary: libview

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.

copyright

COPYRIGHT (c) 1990 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  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.

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
(comment from inherited method)
create - make certain that icon is available

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 raise 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)

Usage example(s):

     self new windowStyle

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.

Usage example(s):

     |b|

     b := InfoBox title:'hello there'.
     b autoHideAfter:5 with:[].
     b showAtCenter.

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  openModalEnsuringDestroyedAfterwards

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.

Usage example(s):

     |b|

     b := InfoBox title:'hello'.
     b show.

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

Usage example(s):

     |b|

     b := InfoBox title:'hello'.
     b showAt:(0 @ 0).
     b showAt:(400 @ 400).

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

Usage example(s):

     |b|

     b := InfoBox title:'hello'.
     b showAt:(100 @ 100) center:true.
     b showAt:(100 @ 100) center:false.

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

Usage example(s):

     |b|

     b := InfoBox title:'hello'.
     b showAt:(100 @ 100).
     b showAt:(100 @ 100) centerX:true centerY:false.

o  showAtCenter
make myself visible at the screen center.

Usage example(s):

     |b|

     b := InfoBox title:'hello'.
     b showAtCenter.

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).

Usage example(s):

     |b|

     b := InfoBox title:'hello'.
     b showAtPointer.

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.

Usage example(s):

     |b|

     b := InfoBox title:'hello'.
     b showCenteredIn:Transcript.

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.7.0.0; WebServer 1.702 at 20f6060372b9.unknown:8081; Mon, 18 Nov 2024 06:40:39 GMT