Solved

Detecting Function Key press on DHTMLEdit control

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

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
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…
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…

760 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

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now