|
Class: TextBox
Object
|
+--GraphicsMedium
|
+--DisplaySurface
|
+--SimpleView
|
+--View
|
+--TopView
|
+--StandardSystemView
|
+--ModalBox
|
+--DialogBox
|
+--EnterBox
|
+--TextBox
|
+--TextCollectorBox
- Package:
- stx:libwidg2
- Category:
- Views-DialogBoxes
- Version:
- rev:
1.38
date: 2023/11/06 15:14:06
- user: cg
- file: TextBox.st directory: libwidg2
- module: stx stc-classLibrary: libwidg2
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.
copyrightCOPYRIGHT (c) 1992 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.
common dialogs
-
openOn: someText
-
open a textBox on some text,
return (the possibly modified) text if accepted; nil otherwise.
Usage example(s):
-
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.
'
|
-
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
|
-
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
-
defaultExtent
-
(comment from inherited method)
return the default extent of my instances.
The value returned here is usually ignored, and
the value from preferredExtent taken instead.
accessing
-
contents
-
return my contents (i.e. possibly modified text after accept)
-
contents: newText
-
set my contents
-
initialText: aString
-
define the initial text in the texteditor
-
readOnly: aBoolean
-
make my text readOnly or readWrite
accessing-contents
-
textView
-
return my textView component
-
textViewClass: aClassToUseForTheTextView
-
Modified (format): / 15-07-2019 / 16:38:11 / Claus Gittinger
initialization
-
initialize
-
TextBox new showAtPointer
(TextBox title:'hello') showAtPointer
-
initializeTextView
-
destroy the old textView if there is one
-
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
-
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
|
-
title: aString
-
(comment from inherited method)
set the title to be displayed at top of the enterBox.
This is NOT the window title.
queries
-
computePreferredExtent
-
return the extent needed to make everything visible
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.
|
|textBox|
textBox := TextBox new.
textBox title:'some\multiline\title\\enter some text' withCRs.
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.
|
|