--- a/EditField.st Sun May 18 09:45:08 2014 +0100
+++ b/EditField.st Mon Sep 08 17:03:09 2014 +0100
@@ -1385,7 +1385,7 @@
font:aFont
super font:aFont.
- self computeTopMargin.
+ realized ifTrue:[ self computeTopMargin ].
!
maxChars
@@ -1475,6 +1475,12 @@
super cursorLine:1 col:col
!
+cursorLine:line col:col makeVisible:aBoolean
+ "catch cursor movement"
+
+ super cursorLine:1 col:col makeVisible:aBoolean
+!
+
validateCursorCol:col inLine:line
"check of col is a valid cursor position;
return a fixed value if not."
@@ -1894,12 +1900,22 @@
!EditField methodsFor:'initialization & release'!
computeTopMargin
- |innerHeight rest|
+ |innerHeight rest font fontHeight fontDescent|
innerHeight := self innerHeight.
- rest := innerHeight - (gc font height + (gc font descent // 2)).
+ innerHeight <= 0 ifTrue:[ textStartTop := 0. ^ self ].
+
+ font := gc font.
+ fontHeight := font height.
+ fontDescent := font descent.
+ rest := innerHeight - (fontHeight + (fontDescent // 2)).
rest > 1 ifTrue:[
textStartTop := (rest // 2) + margin + topMargin
+ ] ifFalse:[
+ "/ care if font is too high for my height:
+ "/ shift baseline towards the top, so that the same is cut off at both ends.
+ "/ (the heuristic fontDescent//3) gives a few pixels more at the top)
+ textStartTop := 1 "(fontDescent//3)" - ((font ascent + fontDescent - innerHeight) // 2).
].
!
@@ -2037,6 +2053,15 @@
"Modified: / 17-01-2011 / 11:24:22 / cg"
! !
+!EditField methodsFor:'native widget support'!
+
+nativeWindowType
+ "return a symbol describing my native window type
+ (may be used internally by the device as a native window creation hint)"
+
+ ^ #EditField
+! !
+
!EditField methodsFor:'private'!
argForChangeMessage
@@ -2086,13 +2111,13 @@
startAutoScrollDown:y
"no vertical scrolling in editfields"
- ^ self
+ ^ false
!
startAutoScrollUp:y
"no vertical scrolling in editfields"
- ^ self
+ ^ false
!
textChanged
@@ -2170,7 +2195,7 @@
and:[ self hasFocus not
and:[ visLineNr == 1 ]]])
ifTrue:[
- ^ emptyText allItalic colorizeAllWith:Color lightGrey.
+ ^ emptyText allItalic colorizeAllWith:Color lightGray.
].
^ s
@@ -2352,6 +2377,25 @@
]
!
+setClipboardText:something
+ "redefined to refuse to copy the password to the clipboard"
+
+ passwordCharacter notNil ifTrue:[
+ self beep.
+ ^ self
+ ].
+ ^ super setClipboardText:something
+!
+
+setLastStringToReplace: sel
+ "redefined to refuse to remember the password"
+
+ passwordCharacter notNil ifTrue:[
+ ^ self
+ ].
+ ^ super setLastStringToReplace: sel
+!
+
validateNewSelection
"make certain that only one line is ever selected"
@@ -2365,10 +2409,10 @@
!EditField class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libwidg/EditField.st,v 1.235 2014-04-13 21:00:32 stefan Exp $'
+ ^ '$Header: /cvs/stx/stx/libwidg/EditField.st,v 1.243 2014-08-03 12:27:52 cg Exp $'
!
version_CVS
- ^ '$Header: /cvs/stx/stx/libwidg/EditField.st,v 1.235 2014-04-13 21:00:32 stefan Exp $'
+ ^ '$Header: /cvs/stx/stx/libwidg/EditField.st,v 1.243 2014-08-03 12:27:52 cg Exp $'
! !