Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.sys.acorn.programmer > #1731

Re: Defining action of CTRL key...

Path csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!news.musoftware.de!wum.musoftware.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From Martin Wuerthner <spamtrap@mw-software.com>
Newsgroups comp.sys.acorn.programmer
Subject Re: Defining action of CTRL key...
Date Tue, 22 May 2012 22:45:32 +0200
Organization MW Software
Lines 49
Message-ID <396e079452.martin@bach.planiverse.com> (permalink)
References <4802cf78-e210-4afa-acf0-a751668b03bb@hq4g2000vbb.googlegroups.com> <b22fee9352.martin@bach.planiverse.com> <125e67a9-7565-4a7b-8439-53c951ff140b@l17g2000vbj.googlegroups.com>
Mime-Version 1.0
Content-Type text/plain; charset=iso-8859-1
Content-Transfer-Encoding 8bit
X-Trace individual.net lcvBOijfsjn7QZexeC5mwAjPqTaVqCiXgSogPpLE5owhyVxLAUUvc16Unu/lLmjUhq
X-Orig-Path bach.planiverse.com%martin
Cancel-Lock sha1:RbylgcXOnF9YZq6UdvTuLgpsJ8k=
X-Editor EmailEdit 6.00
User-Agent Messenger-Pro/6.03 (MsgServe/6.00) (RISC-OS/5.18) NewsHound/v1.50-32
Xref csiph.com comp.sys.acorn.programmer:1731

Show key headers only | View raw


In message <125e67a9-7565-4a7b-8439-53c951ff140b@l17g2000vbj.googlegro 
ups.com>
          Gazza <usenet@garethlock.com> wrote:

> On May 22, 5:09 pm, Martin Wuerthner <spamt...@mw-software.com> wrote:
>> In message <4802cf78-e210-4afa-acf0-a751668b0...@hq4g2000vbb.googlegro
>> ups.com>
>>           Gazza <use...@garethlock.com> wrote:
>>
>>> [...] Is there any way of neutering the CTRL key in
>>> a similar fashion so that it sets a bit, rather than performing any
>>> other action defined by the VDU drivers?
>>
>> In contrast to Esc, the Ctrl key does not have any associated action,
>> so there is no need to suppress it. You can enquire about the state of
>> the Ctrl key at any time using OS_Byte 121. Whatever code you use to
>> accept keyboard input might do specific things when it sees Ctrl
>> keypresses, so in order to answer your question you need to tell us
>> how you accept and interpret keyboard input in your program.
>> OS_ReadLine, for instance, interprets certain Ctrl keypresses.

> Well... I was running a test program that just read from the keyboard
> and displayed both the ASCII codes and the character/string
> representation on the screen. The idea being I could trap CTRL+<key>
> and display the character on the screen, manually prefixed with "^" if
> it was part of a CTRL combo. However, I was stumbling across special
> cases such as CTRL+U and others which of course do funny things with
> the VDU drivers.

Of course. Simply do not display characters with a code < 32 to the 
screen.

> What I want to do is to intercept this set a flag if
> CTRL was pressed and return the ASCII code of just the character
> pressed. I'm using GET to return ASCII codes with OS_Byte 229 set to a
> non-zero value to supress Escape.

There is no need to do anything special. This is just a question of 
interpreting the values you get. If you look at the returned codes it 
should not be difficult to work out that Ctrl+A is 1, Ctrl+B is 2, 
etc. If you want Ctrl+Shift as well, you need to test the shift key 
explicitly.

-- 
Martin
---------------------------------------------------------------------
Martin Wuerthner         MW Software      http://www.mw-software.com/
        RISC OS Software for Design, Printing and Publishing
---------------------------------------------------------------------

Back to comp.sys.acorn.programmer | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Defining action of CTRL key... Gazza <usenet@garethlock.com> - 2012-05-22 08:42 -0700
  Re: Defining action of CTRL key... Martin Wuerthner <spamtrap@mw-software.com> - 2012-05-22 18:09 +0200
    Re: Defining action of CTRL key... Gazza <usenet@garethlock.com> - 2012-05-22 11:33 -0700
      Re: Defining action of CTRL key... Martin Wuerthner <spamtrap@mw-software.com> - 2012-05-22 22:45 +0200
        Re: Defining action of CTRL key... Gazza <usenet@garethlock.com> - 2012-05-22 16:03 -0700
          Re: Defining action of CTRL key... Gazza <usenet@garethlock.com> - 2012-05-22 23:42 -0700
            Re: Defining action of CTRL key... Gazza <usenet@garethlock.com> - 2012-05-23 16:20 -0700
              Re: Defining action of CTRL key... jgharston <jgh@arcade.demon.co.uk> - 2012-05-24 13:59 -0700
                Re: Defining action of CTRL key... Matthew Phillips <spam2011m@yahoo.co.uk> - 2012-05-24 22:51 +0100
                Re: Defining action of CTRL key... Rick Murray <heyrickmail-usenet@yahoo.co.uk> - 2012-05-26 16:16 +0200
              Re: Defining action of CTRL key... Gazza <usenet@garethlock.com> - 2012-05-25 07:04 -0700
                Re: Defining action of CTRL key... jgharston <jgh@arcade.demon.co.uk> - 2012-05-25 07:48 -0700
                Re: Defining action of CTRL key... Steve Drain <steve@kappa.me.uk> - 2012-05-25 16:30 +0100
                Re: Defining action of CTRL key... jgharston <jgh@arcade.demon.co.uk> - 2012-05-27 05:43 -0700
                Re: Defining action of CTRL key... Rick Murray <heyrickmail-usenet@yahoo.co.uk> - 2012-05-26 16:08 +0200
                Re: Defining action of CTRL key... Harriet Bazley <bazley@feathermail.co.uk> - 2012-06-08 08:55 +0100
                Re: Defining action of CTRL key... Gazza <usenet@garethlock.com> - 2012-06-08 01:16 -0700
            Re: Defining action of CTRL key... Martin Wuerthner <spamtrap@mw-software.com> - 2012-05-24 11:07 +0200
              Re: Defining action of CTRL key... Rick Murray <heyrickmail-usenet@yahoo.co.uk> - 2012-05-26 16:18 +0200
                Re: Defining action of CTRL key... Gazza <usenet@garethlock.com> - 2012-05-27 02:25 -0700
                Re: Defining action of CTRL key... jgharston <jgh@arcade.demon.co.uk> - 2012-05-27 10:00 -0700
                Re: Defining action of CTRL key... jgharston <jgh@arcade.demon.co.uk> - 2012-05-27 10:55 -0700
                Re: Defining action of CTRL key... Gazza <usenet@garethlock.com> - 2012-05-29 10:30 -0700
                Re: Defining action of CTRL key... jgharston <jgh@arcade.demon.co.uk> - 2012-05-29 14:14 -0700
                Re: Defining action of CTRL key... Gazza <usenet@garethlock.com> - 2012-05-29 16:32 -0700
                Re: Defining action of CTRL key... jgharston <jgh@arcade.demon.co.uk> - 2012-05-29 17:34 -0700
                Re: Defining action of CTRL key... Gazza <usenet@garethlock.com> - 2012-05-30 04:06 -0700
                Re: Defining action of CTRL key... jgharston <jgh@arcade.demon.co.uk> - 2012-05-30 04:35 -0700
                Re: Defining action of CTRL key... Gazza <usenet@garethlock.com> - 2012-05-30 05:40 -0700
                Re: Defining action of CTRL key... Gazza <usenet@garethlock.com> - 2012-05-30 10:26 -0700
                Re: Defining action of CTRL key... Gazza <usenet@garethlock.com> - 2012-05-31 06:56 -0700
                Re: Defining action of CTRL key... Gazza <usenet@garethlock.com> - 2012-06-01 05:02 -0700
                Re: Defining action of CTRL key... Gazza <usenet@garethlock.com> - 2012-06-01 07:01 -0700
                Re: Defining action of CTRL key... Gazza <usenet@garethlock.com> - 2012-06-01 07:54 -0700
                Re: Defining action of CTRL key... jgharston <jgh@arcade.demon.co.uk> - 2012-06-02 18:18 -0700
                Re: Defining action of CTRL key... Gazza <usenet@garethlock.com> - 2012-06-03 01:02 -0700
                Re: Defining action of CTRL key... jgharston <jgh@arcade.demon.co.uk> - 2012-06-06 17:29 -0700
                Re: Defining action of CTRL key... Gazza <usenet@garethlock.com> - 2012-06-07 16:37 -0700
                Re: Defining action of CTRL key... Steve Drain <steve@kappa.me.uk> - 2012-06-08 12:00 +0100
                Re: Defining action of CTRL key... Gazza <usenet@garethlock.com> - 2012-06-08 09:00 -0700
                Re: Defining action of CTRL key... Gazza <usenet@garethlock.com> - 2012-06-11 16:14 -0700
                Re: Defining action of CTRL key... jgharston <jgh@arcade.demon.co.uk> - 2012-06-17 17:12 -0700
                Re: Defining action of CTRL key... jgharston <jgh@arcade.demon.co.uk> - 2012-06-18 13:24 -0700
                Re: Defining action of CTRL key... Jeremy Nicoll - news posts <jn.nntp.scrap007@wingsandbeaks.org.uk> - 2012-06-16 20:18 +0100
                Re: Defining action of CTRL key... Gazza <usenet@garethlock.com> - 2012-06-17 16:08 -0700
                Re: Defining action of CTRL key... Jeremy Nicoll - news posts <jn.nntp.scrap007@wingsandbeaks.org.uk> - 2012-06-18 04:45 +0100
                Re: Defining action of CTRL key... Gazza <usenet@garethlock.com> - 2012-06-18 14:49 -0700
                Re: Defining action of CTRL key... druck <news@druck.org.uk> - 2012-06-18 18:41 +0100
                Re: Defining action of CTRL key... jgharston <jgh@arcade.demon.co.uk> - 2012-06-18 13:26 -0700

csiph-web