Path: news.daimi.aau.dk!jlk From: jlk@daimi.aau.dk (Jorgen Lindskov Knudsen) Newsgroups: comp.lang.beta Subject: Re: character input problem Date: 11 Feb 1998 14:20:53 GMT Organization: DAIMI, Computer Science Dept. at Aarhus University Lines: 62 Message-ID: <6bsc45$gvo$1@nf.aau.dk> References: <34e689f7.18812140@news.bart.nl> Reply-To: jlknudsen@daimi.aau.dk (Jorgen Lindskov Knudsen) NNTP-Posting-Host: fraxinus.daimi.aau.dk Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Newsreader: NN version 6.5.1 (NOV) Xref: news.daimi.aau.dk comp.lang.beta:11388 In <34e689f7.18812140@news.bart.nl> wimb@gld.bart.nl (Wim Boot) writes: >Hi, >I just started with BETA (r4.1) and now I'm trying to run the tutorial >program "WindowWithStdMenubar". >Everything seems to work except for character input. I have modified >the code a little to see what is happening and it appears that >ch is always character zero. Shift state isn't recognized either. >Someone got a clue what's wrong? We have looked into your problem, and your problem is due to a bug in the NT implementation. In 'onKeyDown' in eventhandlers associated directly with a window (as in your example), the 'ch' variable is erroneously not assigned any value. You should instead have e.g. a textfield in the window. Here you will be able to access the 'ch' within 'onKeyDown', e.g.: ORIGIN '~beta/guienv/v1.6/guienv'; (* This demo shows how to create a simple window with a * standardMenubar where the file menu only has one menuitem. It also * illustrates how to further bind the onMouseDown, onMouseUp, * onKeyDown event patterns. *) INCLUDE '~beta/guienv/v1.6/fields' --- program: descriptor --- guienv (# theWindow: @window (# t: @textfield (# eventHandler:: (# onKeyDown:: (# do 'onKeyDown: ' -> puttext; (if shiftKey then ' (uc) ' -> puttext else ' (lc) ' -> puttext if); ch -> putint; newLine #) #) #); open:: (# do t.open#) #) do theWindow.open #) Please note, that this new example displays another error, namely that 'shiftKey' is not 'reliable' on NT. It gives the wrong answer for some characters. You (or we) seem to be 'hit' by Murthy's law :-) Regards, Jørgen Lindskov Knudsen Mjølner Informatics -- * Jorgen Lindskov Knudsen | Phone: +45 8942 3233 Fax: +45 8942 3255 * * Dept. of Computer Science | GSM: +45 2099 7357 * * Univ. of Aarhus, Building 540 | E-mail: jlknudsen@daimi.aau.dk * * Ny Munkegade, DK-8000 Aarhus C | WWW: http://www.daimi.aau.dk/~jlk *