log in | register | forums
Show:
Go:
Forums
Username:

Password:

User accounts
Register new account
Forgot password
Forum stats
List of members
Search the forums

Advanced search
Recent discussions
- Elsear brings super-fast Networking to Risc PC/A7000/A7000+ (News:)
- Latest hardware upgrade from RISCOSbits (News:)
- Accessing old floppy disks (Gen:3)
- November developer 'fireside' chat on saturday night (News:)
- RISCOSbits releases a new laptop solution (News:4)
- Announcing the TIB 2024 Advent Calendar (News:2)
- RISC OS London Show Report 2024 (News:1)
- Code GCC produces that makes you cry #12684 (Prog:39)
- Rougol November 2024 meeting on monday (News:)
- Drag'n'Drop 14i1 edition reviewed (News:)
Latest postings RSS Feeds
RSS 2.0 | 1.0 | 0.9
Atom 0.3
Misc RDF | CDF
 
View on Mastodon
@www.iconbar.com@rss-parrot.net
Site Search
 
Article archives
Acorn Arcade forums: Programming: Keypress Query
 
  Keypress Query
  Chris (07:31 7/7/2005)
  rich (08:00 7/7/2005)
    Chris (09:01 7/7/2005)
      rich (09:20 7/7/2005)
        Chris (09:37 7/7/2005)
          rich (10:44 7/7/2005)
            tribbles (11:16 7/7/2005)
              monkeyson2 (11:38 7/7/2005)
                Chris (12:01 7/7/2005)
            Chris (11:45 7/7/2005)
 
Chris Message #67261, posted by Chris at 07:31, 7/7/2005
Member
Posts: 283
Dear gurus,

A simple (I hope) problem: how do you respond to keypresses such as Ctrl+A under the Wimp? Simple printable character codes are fine, and there is a table in the PRMs for special key combinations like Ctrl+F3, but I can't immediately see how you handle 'altered' printable characters.

Apologies if I've missed something very obvious, but grateful for any help.
  ^[ Log in to reply ]
 
Richard Goodwin Message #67264, posted by rich at 08:00, 7/7/2005, in reply to message #67261
Rich
Dictator for life
Posts: 6828
How are you checking for it? In a writable icon, or in general use - e.g. like Menon, which will respond to CTRL-A by loading ArtWorks for me if nothing else claims that key combo at the time?
________
RichGCheers,
Rich.
  ^[ Log in to reply ]
 
Chris Message #67269, posted by Chris at 09:01, 7/7/2005, in reply to message #67264
Member
Posts: 283
In general use. My app has a menu option to create a new record, which I also want to happen when Ctrl+N is pressed when the window has the input focus.
  ^[ Log in to reply ]
 
Richard Goodwin Message #67270, posted by rich at 09:20, 7/7/2005, in reply to message #67269
Rich
Dictator for life
Posts: 6828
So it's only when you have the window focus? OK... I'm using INKEY commands (in BASIC, obviously), but that's for actually opening windows of a program that doesn't have input focus :)

If you have input focus, doesn't that mean you *are* doing this in text input boxes (mostly)? It might be worth changing the validation strings of your inputs so that they use Ktarn rather than the usual Ktar - that way, notificiations of all key presses are passed to the program. Then you should see more being passed on in wimp poll (eight) messages.

Or an actual programmer can chip in...? :)
________
RichGCheers,
Rich.
  ^[ Log in to reply ]
 
Chris Message #67271, posted by Chris at 09:37, 7/7/2005, in reply to message #67270
Member
Posts: 283
Sorry - I'm not being clear at all...

<rephrase>
I've got no problem intercepting the keypress: my problem is I don't know what character code to check for. If someone presses Return, I can check for character code 13. If someone presses Ctrl+F3, there's a list of character codes in the PRM. But I don't know what code to check for if someone presses Ctrl+N: I assume it's ASC("N" ) plus something.
</rephrase>

Thanks for the tip on Ktarn, though - I'd forgotten about that and it will be useful (for another reason, however :) ).
  ^[ Log in to reply ]
 
Richard Goodwin Message #67272, posted by rich at 10:44, 7/7/2005, in reply to message #67271
Rich
Dictator for life
Posts: 6828
OIC - CTRL-A = 1 CTRL-B = 2 etc? They're standard ASCII characters.

(Of course, I didn't actually remember that until I'd modified one of my programs to report what was being passed on by wimp polls ;) )
________
RichGCheers,
Rich.
  ^[ Log in to reply ]
 
Jason Tribbeck Message #67273, posted by tribbles at 11:16, 7/7/2005, in reply to message #67272
tribbles
Captain Helix

Posts: 929
Or simply (in C):

switch(code) {
case 'A' - 64 :
// Ctrl-A

//...
}

Other languages would be similar (it's been a long time since I've done BASIC. Could be ASC("A" ) - 64...
  ^[ Log in to reply ]
 
Phil Mellor Message #67276, posted by monkeyson2 at 11:38, 7/7/2005, in reply to message #67273
monkeyson2Please don't let them make me be a monkey butler

Posts: 12380
Ctrl-N is &E according to the WimpKeys Stronghelp manual.
  ^[ Log in to reply ]
 
Chris Message #67278, posted by Chris at 11:45, 7/7/2005, in reply to message #67272
Member
Posts: 283
Hmm. I should have thought of that (reporting back what the Wimp Poll was broadcasting, that is). So much for being proactive!

But thanks - that's really helpful. I think I'm finally getting nearer a release date... :o
  ^[ Log in to reply ]
 
Chris Message #67281, posted by Chris at 12:01, 7/7/2005, in reply to message #67276
Member
Posts: 283
Ctrl-N is &E according to the WimpKeys Stronghelp manual.
Now I feel really stupid - I did look at the StrongHelp manuals but somehow missed the one helpfully called WimpKeys... :blush:
  ^[ Log in to reply ]
 

Acorn Arcade forums: Programming: Keypress Query