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
                                 |
                                 +--TextCollectorBox

Package:
stx:libwidg2
Category:
Views-DialogBoxes
Version:
rev: 1.31 date: 2019/07/15 14:39:49
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  contents: newText
set my contents

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: aClassToUseForTheTextView
Modified (format): / 15-07-2019 / 16:38:11 / Claus Gittinger

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

o  initializeTextViewLayout
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

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

queries
o  computePreferredExtent
return the extent needed to make everything visible


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.2.0.0; WebServer 1.670 at bd0aa1f87cdd.unknown:8081; Thu, 25 Apr 2024 01:42:08 GMT