--- a/LEnterFld.st Tue May 09 03:58:26 1995 +0200
+++ b/LEnterFld.st Fri May 12 20:34:25 1995 +0200
@@ -10,7 +10,7 @@
hereby transferred.
"
-SimpleView subclass:#LabelledEnterField
+View subclass:#LabelledEnterField
instanceVariableNames:'labelField textField'
classVariableNames:''
poolDictionaries:''
@@ -21,7 +21,7 @@
COPYRIGHT (c) 1991 by Claus Gittinger
All Rights Reserved
-$Header: /cvs/stx/stx/libwidg2/Attic/LEnterFld.st,v 1.6 1995-05-07 00:18:17 claus Exp $
+$Header: /cvs/stx/stx/libwidg2/Attic/LEnterFld.st,v 1.7 1995-05-12 18:34:16 claus Exp $
written winter 91 by claus
'!
@@ -29,14 +29,62 @@
documentation
"
- An EnterField with a name.
+ An EnterField with a name. Its protocol mimics that of an
+ inputfield for the most common cases. However, for access to
+ some specific things, you have to get the components
+ (labelField and inputField)
+ and send those message directly.
+"
+!
+
+examples
+"
+ |top panel f1 f2 f3 f4 model data|
+
+ data := #('John' 'F' 'Smith' '1234567').
+ model := Plug new.
+ model respondTo:#firstName with:[data at:1].
+ model respondTo:#firstName: with:[:arg | data at:1 put:arg].
+ model respondTo:#middleInitial with:[data at:2].
+ model respondTo:#middleInitial: with:[:arg | data at:2 put:arg].
+ model respondTo:#lastName with:[data at:3].
+ model respondTo:#lastName: with:[:arg | data at:3 put:arg].
+ model respondTo:#telNo with:[data at:4].
+ model respondTo:#telNo: with:[:arg | data at:4 put:arg].
+ top := StandardSystemView new.
+ top extent:300@300.
+
+ panel := VerticalPanelView origin:0.0@0.0 corner:1.0@1.0 in:top.
+ panel verticalLayout:#topSpace.
+
+ f1 := LabelledEnterField new.
+ f1 label:'Firstname:'.
+ f1 model:model; aspect:#firstName; change:#firstName:.
+ panel add:f1.
+
+ f2 := LabelledEnterField new.
+ f2 label:'Middle Initial:'.
+ f2 model:model; aspect:#middleInitial; change:#middleInitial:.
+ panel add:f2.
+
+ f3 := LabelledEnterField new.
+ f3 label:'Lastname:'.
+ f3 model:model; aspect:#lastName; change:#lastName:.
+ panel add:f3.
+
+ f4 := LabelledEnterField new.
+ f4 label:'Telephone:'.
+ f4 model:model; aspect:#telNo; change:#telNo:.
+ panel add:f4.
+
+ top open
"
!
version
"
-$Header: /cvs/stx/stx/libwidg2/Attic/LEnterFld.st,v 1.6 1995-05-07 00:18:17 claus Exp $
+$Header: /cvs/stx/stx/libwidg2/Attic/LEnterFld.st,v 1.7 1995-05-12 18:34:16 claus Exp $
"
!
@@ -61,11 +109,13 @@
super initialize.
- labelField := Label in:self.
+ labelField := Label label:'l' in:self.
+ textField := EditField in:self.
+
+ labelField resize.
labelField level:0.
- labelField origin:[margin @ (margin + textField margin)].
+ labelField origin:(margin @ (margin + textField margin)).
- textField := EditField in:self.
textField origin:[(labelField origin x + labelField width) @ level]
extent:[(self width
- margin - margin
@@ -81,16 +131,81 @@
"
! !
+!LabelledEnterField methodsFor:'queries'!
+
+preferedExtent
+ |p lx ly ix iy|
+
+ p := labelField preferedExtent.
+ lx := p x. ly := p y.
+ p := textField preferedExtent.
+ ix := p x. iy := p y.
+ ^ (lx + ix) @ (ly max:iy)
+! !
+
!LabelledEnterField methodsFor:'accessing'!
+labelView
+ "return the label component"
+
+ ^ labelField
+!
+
+inputField
+ "return the input field component"
+
+ ^ textField
+! !
+
+!LabelledEnterField methodsFor:'accessing-behavior'!
+
disable
- textField disable
+ textField disable
+!
+
+enable
+ textField enable
+! !
+
+!LabelledEnterField methodsFor:'accessing-mvc'!
+
+model:aModel
+ textField model:aModel.
+ labelField model:aModel
+!
+
+changeMessage:aSymbol
+ textField changeMessage:aSymbol
!
+aspect:aspectSymbol
+ textField aspect:aspectSymbol.
+ labelField aspect:aspectSymbol
+!
+
+labelMessage:aSymbol
+ labelField labelMessage:aSymbol
+!
+
+addModelInterfaceTo:aDictionary
+ labelField addModelInterfaceTo:aDictionary.
+ textField addModelInterfaceTo:aDictionary
+! !
+
+!LabelledEnterField methodsFor:'accessing-look'!
+
label:aString
labelField label:aString
!
+editValue
+ ^ textField editValue
+!
+
+editValue:something
+ textField editValue:something
+!
+
contents
^ textField contents
!