.
"
COPYRIGHT (c) 1991 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.
"
View subclass:#LabelledEnterField
instanceVariableNames:'labelField textField'
classVariableNames:''
poolDictionaries:''
category:'Views-Interactors'
!
LabelledEnterField comment:'
COPYRIGHT (c) 1991 by Claus Gittinger
All Rights Reserved
$Header: /cvs/stx/stx/libwidg2/Attic/LEnterFld.st,v 1.7 1995-05-12 18:34:16 claus Exp $
written winter 91 by claus
'!
!LabelledEnterField class methodsFor:'documentation'!
documentation
"
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.7 1995-05-12 18:34:16 claus Exp $
"
!
copyright
"
COPYRIGHT (c) 1991 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.
"
! !
!LabelledEnterField methodsFor:'initialization'!
initialize
"setup; create the label and an enterfield"
super initialize.
labelField := Label label:'l' in:self.
textField := EditField in:self.
labelField resize.
labelField level:0.
labelField origin:(margin @ (margin + textField margin)).
textField origin:[(labelField origin x + labelField width) @ level]
extent:[(self width
- margin - margin
- labelField width) @ (textField heightIncludingBorder)].
"
forward keyboard input to the enterField
"
self delegate:(KeyboardForwarder from:self toView:textField)
"
LabelledEnterField new realize
"
! !
!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
!
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
!
contents:aString
textField contents:aString
! !