473,326 Members | 2,133 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

OnKeyDown function problem

3
Hi!
I have a problem using the OnKeyDown function in Visual C++ 6.0. The problem is that the source code seems to be all right, but when I press a button I only get a speaker beep and nothing else happens, the function code isn't executed. In the dialog box I also have 2 scrolls and I think that after starting the application they get focus or something like that and the keybord event doesn't even occur. Using keybord I can only move the scrolls with cursors, but that's not what I had in mind:) Can anybody help me?
Aug 28 '07 #1
5 4907
Banfa
9,065 Expert Mod 8TB
I do not think a dialog box receives keyboard messages.

Even if it did since the control (scrollbar) is the window with input focus the keyboard events would go there.

What keys did you want the scrollbars to respond to?
Aug 28 '07 #2
lopat
3
I wanted to use W S A D keys. If I disable the scrollbars everything seems to work fine.
Aug 29 '07 #3
Banfa
9,065 Expert Mod 8TB
I wanted to use W S A D keys. If I disable the scrollbars everything seems to work fine.
That is because when the scrollbars are disabled they can not have the input focus.

You want to use W S A D to control the scrollbars?

If so then subclassing them would let you do it, is this a WIN32 or MFC application?
Aug 29 '07 #4
lopat
3
It is a MFC application
Aug 30 '07 #5
Banfa
9,065 Expert Mod 8TB
You will need to subclass the scrollbars, intercept the keydown messages you are interested in (those for A S D W) and then handle them.

Handling them may just be posting them to the parent window (the dialog box) so that it can handle them or it may be taking other direct action.

In MFC this sublass is easy, create a new class with CScrollBar as it's parent class. Then you can just added new message map entries to the message map of your class and then where your dialog class is defined use your derived class instead of the default CScrollBar class.
Aug 30 '07 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

6
by: Z | last post by:
I have sub-classed the TextBox. In its OnKeyDown event I can intercept key strokes, examine them, etc. When I get a certain keycode (e.g., 'A') I want to change it to another unicode key from a...
4
by: KublaiKhan | last post by:
I am trying to figure out what values are returned when keys are pressed in Mozilla & IE. Here's the code I'm using. There are no alerts in either browser. Any clues would be greatly appreciated....
3
by: euler | last post by:
why did the keydown event not fire in this simple example? <HTML> <HEAD><title>keydown_div</title> <script type="text/javascript"> function keydown() { alert("keydown"); } </script>
10
by: b.dam | last post by:
I'm trying the following: function grid() { this._el = document.createElement("TABLE"); var self = this; document.addEventListener("onkeydown", function(event) {self.gridKeyDown(event);},...
2
by: Iver Erling Årva | last post by:
I have come across a problem with the onKeyDown event in some of my forms. I'm using onKeyDown in <form> as a standard method to open my help screen system throughout my system, but I have...
0
by: =?Utf-8?B?Q0dX?= | last post by:
I have a .NET 1.1 application which uses several grids of text boxs (in repeaters and datagrids) for entering arrays of time values. I use onkeydown to allow users to navigate through the grids...
0
by: CGW | last post by:
I posted this in a .NET general newsgroup, but then found this group and I think it would be more appropriately posted here. Even though the problem is partially with client side behavior, I'm...
1
eboyjr14
by: eboyjr14 | last post by:
I have this UserScript for Grease monkey. but I can't get the onleydown event to fire in FIREFOX only. I've looked everywhere! // ==UserScript== // @name iGoogle Suggest //...
3
by: gjain12 | last post by:
Hi all, I am using the following code to disable the ctrl+a/c/v/x keys. <html> <head> <script language="JavaScript" type="text/javascript"> function disableCtrlKeyCombination(e) { //list...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.