Solved

Detecting Function Key press on DHTMLEdit control

Posted on 2006-10-24
1
374 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

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

Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses
Course of the Month6 days, 11 hours left to enroll

636 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