#REFACTORING by cg
class: TextBox
added: #initializeTextViewLayout
comment/format in: #textViewClass:
changed: #initialize
--- a/TextBox.st Mon Jul 15 15:37:46 2019 +0200
+++ b/TextBox.st Mon Jul 15 16:39:49 2019 +0200
@@ -210,18 +210,37 @@
^ textView
!
-textViewClass:something
- textViewClass := something.
+textViewClass:aClassToUseForTheTextView
+ textViewClass := aClassToUseForTheTextView.
+
+ "Modified (format): / 15-07-2019 / 16:38:11 / Claus Gittinger"
! !
!TextBox methodsFor:'initialization'!
initialize
- |space2 space3 innerWidth|
-
super initialize.
enterField destroy.
+ textView := HVScrollableView for:(textViewClass ? EditTextView) miniScrollerH:true in:self.
+ "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"
+ self initializeTextViewLayout.
+
+ self delegate:(KeyboardForwarder toView:textView scrolledView)
+
+ "
+ TextBox new showAtPointer
+ (TextBox title:'hello') showAtPointer
+ "
+
+ "Modified: / 29-10-2010 / 17:14:49 / cg"
+ "Modified (comment): / 15-07-2019 / 16:37:40 / Claus Gittinger"
+!
+
+initializeTextViewLayout
+ |space2 space3 innerWidth labelHeight|
space2 := 2 * ViewSpacing.
space3 := 3 * ViewSpacing.
@@ -231,22 +250,18 @@
- avoid visible resizing when realized the first time"
innerWidth := width - space2.
-
- textView := HVScrollableView for:(textViewClass ? EditTextView) miniScrollerH:true in:self.
- textView origin:(ViewSpacing @ (space2 + labelField height))
- extent:(innerWidth @ (height - ViewSpacing -
- labelField height - ViewSpacing -
- buttonPanel height - space3) ).
- textView origin:[ViewSpacing @ (space2 + labelField height)]
+ labelHeight := labelField height.
+
+"/ textView origin:(ViewSpacing @ (space2 + labelField height))
+"/ extent:(innerWidth @ (height - ViewSpacing -
+"/ labelField height - ViewSpacing -
+"/ buttonPanel height - space3) ).
+ textView origin:[ViewSpacing @ (space2 + labelHeight)]
extent:[(width - space2) @ (height - ViewSpacing -
- labelField height - ViewSpacing -
+ labelHeight - ViewSpacing -
buttonPanel height - space3) ].
- self delegate:(KeyboardForwarder toView:textView scrolledView)
-
- "TextBox new showAtPointer"
-
- "Modified: / 29-10-2010 / 17:14:49 / cg"
+ "Created: / 15-07-2019 / 16:36:41 / Claus Gittinger"
!
openOn:someText title:titleString windowTitle:windowTitle readOnly:readOnly