[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

MCL characters



I've tried this before, but the answers wheren't satisfying, and since
I'm quite desperate I try again.

I'm writing a small text editor in CLIM 1.0 and MCL 2.0 (both beta),
but I believe the question is only related to MCL.

CLIM offers a way to get keyboard events (as well as mouse events),
i.e. it calls a function when the user hits a key. The only parameter
is the character read, corresponding to the key hit. I want to look up
the editor command corresponding to the character, and more
specificly, want to see the difference between e.q a, ctrl-a and
meta-a (option-a) keys (characters). 

Just to see what characters I got, I collected characters in a list
and looked at it in the *Listener*. It printed out different
representations of the above mentioned three characters: #\a , #<c-a>
and #<m-a> . However, the inspector didn't reveal any difference in
the char-code of these, it was the same. Somehow the representation
must differ, since the printer knows the difference, as the printout
showed.

To look up the corresponding editor command I must know how to compare
the newly read character with character constants stored somewhere.
So the question is: How can I make character constants for the three
characters mentioned above (and all others of course) and what
function should I use to compare them with read characters?

I would also be nice to have functions control-character-p and
meta-character-p (option-character-p) for classifying characters. I
know there exists functions that, during event processing, tells if
the option- and ctrl-keys were pressed, but I'd rather prefer to look
at the character itself.

As a last solution, I can type in the characters by hand to get the
character constants to compare with. But then I will need to store
them in a file so I don't have to do it every time the editor starts
up. I.e. something like: (fasl-dump character) or rather
(fasl-dump character-vector) and read it in again with plain (read).

I hope you can give me help on this, I'm quite stuck.

Regards, Hallvard Traetteberg
--
Hallvard Traetteberg
Dept. of Knowledge Based Systems
Center for Industrial Research
Box 124 Blindern, 0314 Oslo 3
NORWAY

Tlf: +47 2 45 20 10
Fax: +47 2 45 20 40
Email: haltraet@si.no