[Date Prev][Date Next][Subject Prev][Subject Next][ Date Index][ Subject Index]

Re: variant



Reply to note from Harry Binswanger  Tue, 21 Dec
2004 00:38:21 -0500

Harry:

> I have some difficulties when running an XPL program and
> getting user-input via . In these cases, the ENTER key is
> supposed to terminate the user's input and exit the  loop.
> But the old "in" (ascii 238) test for ENTER no longer works.

Of course it doesn't! If Enter doesn't put a , how can a test
for a  capture the Enter key? It can't. It's fine to test for
a character if you're soliciting characters as input (as in "bort
tore uit"). But, with a remappable keyboard, if you're
soliciting a keystroke (as in "Hit Enter to continue"), then you
need to test for the keystroke, not the underlying assignment.

You detect a particular keystroke by testing for its Key Code
(unshifted Scan Code), or VA$KC:

XPLeNCODE v2.0
b-gin [UNTITLED]
{<}PRPress a key{>}{<}SX01,{<}RK{>}{>}{<}IF{<}VA$KC{>}==28!{<
}VA$KC{>}==104{>}{<}PRYou pressed Enter!{>}{<}EX{>}{<}EI{>}{<
}PRYou pressed something else{>}{<}EX{>}[cr|lf][cr|lf]
-nd
XPLeNCODE

That works no matter what's assigned to Enter. See what you got
yourself into, Harry? I warned you about tradeoffs galore. Here's
Tradeoff #1: Now you have to rewrite all of your XPL to use VA$KC.
(Which, of course, is how it should have been written in the first
place, if you wrote it for Xy4.)

> Hmmm. Wouldn't it be possible to do the ultimate fix here? What
> if U2 gets triggered if and only if there's no regular Xy
> command found for the string entered? Something along the lines
> of:
>
> IF VA$ER = 12 then ...

It may be *your* ultimate fix. But there are steep costs here, too,
as I suggested in my earlier post. A biggie is that you can't use
this sort of helpkey to launch a U2 framename that's identical to a
native command. There are plenty such framenames, and some of them
are highly useful if not critical. You can rejigger the helpkey so
that framenames have priority over native commands -- but then you
can't execute any native command that happens to be identical to a
framename. Not good, either.

You'll find that this "ultimate" helpkey is a tricky thing to code
-- not just a matter of testing for VA$ER==12. You've got to worry
about suppressing unwanted error messages, not smothering relevant
error messages, avoiding bad beeps, and keeping good beeps. And
then there's the problem of preserving informational PRompts if a
native command succeeds while suppressing the Error 12 PRompt (and
only that PRompt!) if the command fails. Good luck.

> This change, if it is feasible, would have a climactic effect:
> virtually merging U2 with the factory code. No longer would a
> user have to remember (or even know) if a given command was
> built-in or U2-ed in by Carl and Robert.

Sounds about as desirable as acid rain. We'd prefer that users be
aware when they're using U2, and distinguish clearly between that
set of tools and built-in commands.

We've been around this block many times before, Robert and I --
tried all kinds of Helpkey-XC configurations. But we always came
back to separate keys for commands and franemanes as the cleanest
arrangement with the fewest compromises. But... live with your idea
for a while and decide for yourself.

--
Carl Distefano
cld@xxxxxxxx