EditField.st
changeset 1103 0efbd1ac68f4
parent 1080 73877901fa7d
child 1108 3d14bb6bceb7
equal deleted inserted replaced
1102:d68cff021b9a 1103:0efbd1ac68f4
  1205 
  1205 
  1206     |l oldWidth|
  1206     |l oldWidth|
  1207 
  1207 
  1208     l := someText.
  1208     l := someText.
  1209     l size > 1 ifTrue:[
  1209     l size > 1 ifTrue:[
  1210 	l := OrderedCollection with:(l at:1)
  1210         l := OrderedCollection with:(l at:1)
  1211     ].
  1211     ].
  1212     oldWidth := self widthOfContents.
  1212     oldWidth := self widthOfContents.
  1213     super list:l.
  1213     super list:l.
  1214     self widthOfContents ~~ oldWidth ifTrue:[
  1214     self widthOfContents ~~ oldWidth ifTrue:[
  1215 	self changed:#preferredExtent
  1215         self changedPreferredBounds:nil
  1216     ]
  1216     ]
       
  1217 
       
  1218     "Modified: 6.3.1997 / 16:13:36 / cg"
  1217 !
  1219 !
  1218 
  1220 
  1219 stringValue
  1221 stringValue
  1220     "alias for #contents - for compatibility with ST-80's InputField"
  1222     "alias for #contents - for compatibility with ST-80's InputField"
  1221 
  1223 
  1571     "
  1573     "
  1572      should (& can) we resize ?
  1574      should (& can) we resize ?
  1573     "
  1575     "
  1574     xCol := (self xOfCol:cursorCol inVisibleLine:cursorLine) - leftOffset.
  1576     xCol := (self xOfCol:cursorCol inVisibleLine:cursorLine) - leftOffset.
  1575     (xCol > (width * (5/6))) ifTrue:[
  1577     (xCol > (width * (5/6))) ifTrue:[
  1576 	self changed:#preferredExtent
  1578         self changedPreferredBounds:nil
  1577     ] ifFalse:[
  1579     ] ifFalse:[
  1578 	newWidth < (width * (1/6)) ifTrue:[
  1580         newWidth < (width * (1/6)) ifTrue:[
  1579 	    self changed:#preferredExtent
  1581             self changedPreferredBounds:nil
  1580 	]
  1582         ]
  1581     ].
  1583     ].
  1582 
  1584 
  1583     autoScrollHorizontally ifTrue:[
  1585     autoScrollHorizontally ifTrue:[
  1584 	"
  1586         "
  1585 	 did someone react (i.e. has my extent changed) ?
  1587          did someone react (i.e. has my extent changed) ?
  1586 	 (if not, we scroll horizontally)
  1588          (if not, we scroll horizontally)
  1587 	"
  1589         "
  1588 	xCol := (self xOfCol:cursorCol inVisibleLine:cursorLine) - leftOffset.
  1590         xCol := (self xOfCol:cursorCol inVisibleLine:cursorLine) - leftOffset.
  1589 	(xCol > (width * (5/6))) ifTrue:[
  1591         (xCol > (width * (5/6))) ifTrue:[
  1590 	    newOffset := leftOffset + (width // 2).
  1592             newOffset := leftOffset + (width // 2).
  1591 	] ifFalse:[
  1593         ] ifFalse:[
  1592 	    (xCol < (width * (1/6))) ifTrue:[
  1594             (xCol < (width * (1/6))) ifTrue:[
  1593 		newOffset := 0 max: leftOffset - (width // 2).
  1595                 newOffset := 0 max: leftOffset - (width // 2).
  1594 	    ] ifFalse:[
  1596             ] ifFalse:[
  1595 		newOffset := leftOffset
  1597                 newOffset := leftOffset
  1596 	    ]
  1598             ]
  1597 	].
  1599         ].
  1598 	newOffset ~~ leftOffset ifTrue:[
  1600         newOffset ~~ leftOffset ifTrue:[
  1599 	    self scrollHorizontalTo:newOffset.
  1601             self scrollHorizontalTo:newOffset.
  1600 	]
  1602         ]
  1601     ].
  1603     ].
       
  1604 
       
  1605     "Modified: 6.3.1997 / 16:13:59 / cg"
  1602 !
  1606 !
  1603 
  1607 
  1604 showFocus:explicit
  1608 showFocus:explicit
  1605     "/ giving me the focus is loke clicking on me
  1609     "/ giving me the focus is loke clicking on me
  1606     "/ (tell my enterFieldGroup ....
  1610     "/ (tell my enterFieldGroup ....
  1923 ! !
  1927 ! !
  1924 
  1928 
  1925 !EditField class methodsFor:'documentation'!
  1929 !EditField class methodsFor:'documentation'!
  1926 
  1930 
  1927 version
  1931 version
  1928     ^ '$Header: /cvs/stx/stx/libwidg/EditField.st,v 1.84 1997-02-28 18:47:08 cg Exp $'
  1932     ^ '$Header: /cvs/stx/stx/libwidg/EditField.st,v 1.85 1997-03-06 15:14:22 cg Exp $'
  1929 ! !
  1933 ! !