eXept Software AG Logo

Smalltalk/X Webserver

Documentation of class 'TextBox':

Home

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

Class: TextBox


Inheritance:

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

Package:
stx:libwidg2
Category:
Views-DialogBoxes
Version:
rev: 1.26 date: 2017/02/04 21:18:40
user: cg
file: TextBox.st directory: libwidg2
module: stx stc-classLibrary: libwidg2

Description:


this class implements a pop-up box to enter some text with 2 buttons,
one to cancel, another to start some action.
It is basically an enterBox, but allows entering of more than one line
of text.


Class protocol:

common dialogs
o  openOn: someText
open a textBox on some text,
return (the possibly modified) text if accepted; nil otherwise.
usage example(s):
     TextBox openOn:'hello'

o  openOn: someText title: titleString
open a textBox on some text, the titleString is shown above the text area as information
return (the possibly modified) text if accepted; nil otherwise.
usage example(s):
     TextBox openOn:'hello' title:'hi there'
     TextBox openOn:'hello' title:'hi there
this is a very long title
but only the first line is shown in the
caption.
'

o  openOn: someText title: titleString readOnly: readOnly
open a textBox on some text,
return (the possibly modified) text if accepted; nil otherwise.
usage example(s):
     TextBox openOn:'hello' title:'hi there' readOnly:true
     TextBox openOn:'hello' title:'hi there' readOnly:false

o  openOn: someText title: titleString windowTitle: windowTitle readOnly: readOnly
open a textBox on some text, the optional titleString is shown as label
above the text areay. The optional windowTitle is used as title in the caption.
return (the possibly modified) text if accepted; nil otherwise.
usage example(s):
     TextBox openOn:'hello' title:'hi there' windowTitle:'some Box' readOnly:true
     TextBox openOn:'hello' title:'hi there' windowTitle:'some Box' readOnly:false
     TextBox openOn:'hello' title:'hi there' windowTitle:nil readOnly:false
     TextBox openOn:'hello' title:nil windowTitle:'some Box' readOnly:false
     TextBox openOn:'hello' title:nil windowTitle:nil readOnly:false
     TextBox openOn:'hello' title:nil windowTitle:'foo' readOnly:false

defaults
o  defaultExtent


Instance protocol:

accessing
o  contents
return my contents (i.e. possibly modified text after accept)

o  initialText: aString
define the initial text in the texteditor

o  readOnly: aBoolean
make my text readOnly or readWrite

accessing-contents
o  textView

o  textViewClass: something

initialization
o  initialize
kludge: preset extent to something useful since other subviews
depend on it (extent blocks are not evaluated until view is realized)
- avoid visible resizing when realized the first time

queries
o  preferredExtent
return the extent needed to make everything visible
usage example(s):
If I have an explicit preferredExtent..
usage example(s):
If I have a cached preferredExtent value..


Examples:


Example (using ok-action callBack):
  |textBox|

  textBox := TextBox new.
  textBox title:'enter some text'.
  textBox action:[:text | Transcript showCR:('the entered text was:\' , text) withCRs].
  textBox showAtPointer.
Example (asking afterwards):
  |textBox|

  textBox := TextBox new.
  textBox title:'enter some text'.
  textBox showAtPointer.
  textBox accepted ifTrue:[
      Transcript showCR:'accepted text is:'.
      Transcript showCR:textBox contents
  ].
Example - readonly text (useful for status display):
  |textBox|

  textBox := TextBox new.
  textBox initialText:('Makefile' asFilename contents).
  textBox title:'Makefile:'.
  textBox readOnly:true.
  textBox noCancel.
  textBox label:'Makefile'.
  textBox extent:(600@250); sizeFixed:true.
  textBox showAtPointer.


ST/X 7.1.0.0; WebServer 1.663 at exept.de:8081; Mon, 04 Aug 2025 16:39:42 GMT