|
|
Class: TextBox
Object
|
+--GraphicsContext
|
+--DeviceGraphicsContext
|
+--GraphicsMedium
|
+--DisplaySurface
|
+--SimpleView
|
+--View
|
+--TopView
|
+--StandardSystemView
|
+--ModalBox
|
+--DialogBox
|
+--EnterBox
|
+--TextBox
- Package:
- stx:libwidg2
- Category:
- Views-DialogBoxes
- Version:
- rev:
1.20
date: 2008/10/26 20:10:23
- user: stefan
- 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.
common dialogs
-
openOn: someText
-
open a textBox on some text,
return (the possibly modified) text if accepted; nil otherwise.
-
openOn: someText title: titleString
-
open a textBox on some text,
return (the possibly modified) text if accepted; nil otherwise.
defaults
-
defaultExtent
-
accessing
-
contents
-
return my contents
-
initialText: aString
-
define the initial text in the enterfield
-
readOnly: aBoolean
-
make my text readOnly or readWrite
-
textView
-
initialization
-
initialize
-
queries
-
preferredExtent
-
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.
|
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.
|
|