Solved

Detecting Function Key press on DHTMLEdit control

Posted on 2006-10-24
1
363 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 27

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

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

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

Suggested Solutions

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
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…

770 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