--- a/CharacterSetView.st Thu Feb 26 19:49:25 2004 +0100
+++ b/CharacterSetView.st Fri Feb 27 12:41:40 2004 +0100
@@ -16,7 +16,7 @@
instanceVariableNames:'codePageHolder selectedCodePointHolder masterViewOrNil'
classVariableNames:''
poolDictionaries:''
- category:'Collections-Text-Encodings'
+ category:'Views-Misc'
!
!CharacterSetView class methodsFor:'documentation'!
@@ -44,6 +44,18 @@
Author:
Claus Gittinger
"
+!
+
+examples
+"
+ CharacterSetView openOn:(Button defaultFont).
+
+
+ CharacterSetView
+ openAsInputFor:Transcript
+ label:'Input to Transcript'
+ clickLabel:'Click to input character'
+"
! !
!CharacterSetView class methodsFor:'instance creation'!
@@ -92,7 +104,7 @@
openOn:aFont label:viewLabel clickLabel:clickLabel asInputFor:aView
|top panel v bNext bPrev bFirst bLast rangeLabel codePointLabel
first last next prev enable update updateCodePoint w h
- minPage maxPage|
+ minPage maxPage insertCharacter|
minPage := 0.
maxPage := (aFont onDevice:Screen current) getFontMetrics maxCode >> 8.
@@ -114,6 +126,18 @@
].
"/ actions
+ aView notNil ifTrue:[
+ insertCharacter := [:char |
+ (char isString ifTrue:[char] ifFalse:[Array with:char])
+ do:[:char | |unicodePoint unicodeChar|
+ unicodePoint := CharacterEncoder encode:(char codePoint) from:aView characterEncoding into:'unicode'.
+ unicodeChar := Character value:unicodePoint.
+ aView dispatchEvent:(WindowEvent keyPress:unicodeChar x:0 y:0 view:v).
+ aView dispatchEvent:(WindowEvent keyRelease:unicodeChar x:0 y:0 view:v).
+ ].
+ ].
+ ].
+
updateCodePoint := [
|selectedCodePoint selectedChar
isLetter isDigit isUppercase isLowercase|
@@ -142,6 +166,13 @@
).
].
codePointLabel repairDamage.
+
+ aView notNil ifTrue:[
+ selectedCodePoint notNil ifTrue:[
+ insertCharacter value:(Character value:selectedCodePoint).
+ v selectedCodePointHolder value:nil.
+ ]
+ ]
].
update := [
@@ -444,5 +475,5 @@
!CharacterSetView class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libwidg2/CharacterSetView.st,v 1.15 2004-02-26 16:17:23 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libwidg2/CharacterSetView.st,v 1.16 2004-02-27 11:41:40 cg Exp $'
! !