Umlaut support revisited

Peter Achten peter88@cs.kun.nl
Wed, 03 Dec 1997 11:57:48 +0100


In my previous replay to Georg Bauer's question about umlaut support I have sent two Clean programs, keyspotting, using the 0.8 I/O library, and keyspotting2, using the object I/O library. Unfortunately, I used an unchecked version of keyspotting2 (Tuomas Salonen pointed this out to me, thanks). Below is the correct one (sorry about this ;-).

################### 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
    = snd (openWindow 0 wdef ps)
where
    wdef   = Window "Keyspotting" NilLS
            	      [	WindowId		wid
            	      ,	WindowViewDomain	domain
                    ,	WindowClose		(noLS closeProcess)
	             ,	WindowKeyboard	(\_->True) Able (noLS1 key)
    	             ]
    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