Solved

Detecting Function Key press on DHTMLEdit control

Posted on 2006-10-24
1
365 Views
Last Modified: 2013-12-25
I cant find a method that im completely happy with for detecting the press of a function key on the DHTMLEdit Control. I specifically am trying to test for F7 but i get the same problem with any function key.

The onkeypress events doesnt fire. It only seems to fire for printable characters.

The onkeydown event does fire. If you then query the event you get the keycode 118 (for F7) e.g.

msgbox(DHTMLEdit1.DOM.parentWindow.event.KeyCode)

118 is also the same keycode as you get in the onkeypress event for "v" so i dont trust it. Strangely in my test environment onkeydown does not seem to fire when you press a printable character but i dont trust that it never will.

I was hoping i could let the event bubble up to the control i have placed the DHTMLEdit control on, but no such luck. The DHTMLEdit control seems to swallow it.

Is there another method to check for the press of a function key whilst the focus is on the DHTMLEdit control?
0
Comment
Question by:purplesoup
1 Comment
 
LVL 28

Accepted Solution

by:
Ark earned 500 total points
ID: 17808582
Hi
onkeypress actually returns charCode, not keyCode (they are different for Upper/Low cases). For example, if CapsLock is on, it returns 86 for 'V'
keydown event returns virtual key for a button.
So, if you need to check which KEY was pressed, use onkeydown event. If you need to see which LETTER was typed - use on keypress

HTH
0

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Adding to a VBA? 6 76
vb6 connector to mongodb 2 116
VB6 ListBox Question 4 48
Set WorkSheet  not Working 9 37
If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

791 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question