Umlaut support
Peter Achten
peter88@cs.kun.nl
Tue, 02 Dec 1997 13:37:39 +0100
Dear Georg,
At 09:36 AM 12/2/97 +0100, you wrote:
>Hi!
>
>In Clean there is a problem with 8bit-chars: it doesn't support it in the
>IDE (that I can live with) and in the library (that's a problem to me). I
>asked this before (before this list was an open discussion list) and
>someone told me that the IDE programmer would contact me. Nothing happend
>so far, so I think the request got lost in space and time :-)
>
>Ok. So what are the plans to support 8bit-chars in the library? At least in
>the new library? Because in several european countries you are lost without
>8bit-chars. I don' t need them in identifiers or something fancy, I just
>need to be able to type them to windows that are programmed in Clean.
In both the 0.8 Clean I/O library AND the object I/O library there is no restriction on the kind of character input you receive in windows.
Below I have included two programs: the first, keyspotting, uses the 0.8 I/O library, the second, keyspotting2, uses the object I/O library. Both programs create a fixed size window that can handle keyboard input. For each key down event, the key is displayed in the window. Both programs can be terminated by closing the window. When using these programs you will see that you can type any kind of special character as conventional on your platform: on a Macintosh try for instance Option+u;u which will produce a 'u umlaut'; on Windows95 (and probably NT as well) try ALT+129 which will produce a 'u umlaut'.
Hope this helps,
Peter
###################### keyspotting, using 0.8 I/O library #####################
module keyspotting
import StdEnv, deltaEventIO, deltaWindow, deltaPicture
Start :: *World -> *World
Start world
# (es,world) = OpenEvents world
s = 0
(_,es) = StartIO [WindowSystem [wdef]] s [] es
world = CloseEvents es world
= world
where
wdef = FixedWindow wid (0,0) "Key spotting"
domain (\_ s->(s,[]))
[ GoAway (\s io->(s,QuitIO io))
, Keyboard Able key
]
wid = 1
domain = ((0,0),(300,300))
key :: KeyboardState *s (IOState *s) -> (*s,IOState *s)
key (char,KeyDown,_) s io
= (s,DrawInWindow wid [EraseRectangle domain,MovePenTo (30,200),DrawString (toString char)] io)
key _ s io
= (s,io)
################### keyspotting2, using object I/O library ####################
module keyspotting2
import StdEnv, StdIO
Start :: *World -> *World
Start world
# (wid,world) = openId world
= startIO 0 0 [init wid] [] world
init wid ps
= openWindow 0 wdef ps
where
wdef = Window "Key spotting"
[ WindowId wid
, WindowDomain domain
, WindowClose (noLS closeProcess)
, WindowKeyboard (\_->True) Able key
]
wid = 1
domain = {corner1=zero,corner2={x=300,y=300}}
key :: KeyboardState (PSt .l .p) -> PSt .l .p
key (CharKey char _ _) ps
= appPIO (drawInWindow wid [setPenColour White,fill domain,setPenColour Black,setPenPos {x=30,y=200},draw (toString char)] ps)
key _ ps
= ps