--- a/PrintConv.st Wed Aug 30 19:54:43 1995 +0200
+++ b/PrintConv.st Sat Sep 09 04:30:16 1995 +0200
@@ -11,7 +11,7 @@
"
Object subclass:#PrintConverter
- instanceVariableNames:'valueToStringBlock stringToValueBlock'
+ instanceVariableNames:'valueToStringBlock stringToValueBlock type'
classVariableNames:''
poolDictionaries:''
category:'Interface-Support'
@@ -35,7 +35,7 @@
version
"
-$Header: /cvs/stx/stx/libview2/Attic/PrintConv.st,v 1.7 1995-08-29 17:44:37 claus Exp $
+$Header: /cvs/stx/stx/libview2/Attic/PrintConv.st,v 1.8 1995-09-09 02:29:54 claus Exp $
"
!
@@ -256,8 +256,39 @@
"
! !
+!PrintConverter methodsFor:'accessing'!
+
+type
+ "return the type if its one of the standard converters,
+ #number, #string etc. nil otherwise"
+
+ ^ type
+! !
+
!PrintConverter methodsFor:'initialization'!
+initFor:aTypeSymbol
+ "initialize to convert to/from objects as specified by aTypeSymbol,
+ which may be one of #number, #string, #symbol, #date or #password ..."
+
+ aTypeSymbol == #number ifTrue:[
+ self initForNumber
+ ].
+ (aTypeSymbol == #string or:[aTypeSymbol == #password]) ifTrue:[
+ self initForString
+ ].
+ aTypeSymbol == #date ifTrue:[
+ self initForDate
+ ].
+ aTypeSymbol == #symbol ifTrue:[
+ self initForSymbol
+ ].
+
+ type := aTypeSymbol
+
+ "Modified: 6.9.1995 / 12:10:38 / claus"
+!
+
toPrint:printBlock toRead:readBlock
"initialize to convert using two custom blocks.
printBlock is supposed to get the objects value as argument,
@@ -364,9 +395,15 @@
!PrintConverter methodsFor:'converting'!
printStringFor:aValue
+ "sent when an inputField wants a models value to be converted to a string
+ for display"
+
^ valueToStringBlock value:aValue
!
readValueFrom:aString
+ "sent when an inputField wants a string to be converted to a value
+ to be returned as its contents value"
+
^ stringToValueBlock value:aString
! !