473,783 Members | 2,577 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

KeyPress Event & MouseDown event

I'm writing a program that is designed for quick navigation using
specific buttons on the keyboard. In doing this, I have added a
KeyPress event for every control on the form to intercept the key
pressed and pass it to a standard subroutine that identifies what
action should be taken.

Unfortunately, I have a web-browser contol on the form and the
webbrowser does not include a KeyPress event.

I need some way to intercept keypress and mousedown events for the
webbrowser - my thought was to put a control that has these events on
top of the webbrowser, but I have been unable to find a control that
can be transparent while also sitting on top of a webbrowser - the
imagebox control will be transparent, but for some reason it always
falls behind the webbrowser even when I force it to the Front.

my second thought is to trap key press and mouse click events from
within the html pages I am showing in the webbrowser and then passing
them along to vb - but I don't have the slightest clue how to do that,
or even if it can be done.

Does anyone have any ideas on a soltion to this problem?

any help would be appreciated.

thanks.

Trevor Fairchild
Jul 17 '05
12 24193
Tzargoth
2 New Member
Hmmm ... I found that if a text or textarea field had data in it, that the user can still click through the locking div. To get around this, you need to override the document onmouseup event and change focus to a dummy field (off page -- set it in a 0 size div, with 0 size). Use something like this:

<SCRIPT ID=clientEventH andlersJS LANGUAGE=javasc ript><!--
function document_onmous eup()
{
return CheckLock();
}
//-->
</SCRIPT>
<SCRIPT LANGUAGE=javasc ript FOR=document EVENT=onmouseup ><!--
document_onmous eup();
//-->
</SCRIPT>

In CheckLock:

if (IsLocked)
{
document.getEle mentById("Dummy ").focus();
return false;
}
else
{
return true;
}

Users can still select text, but not modify it. I still use the locking div because when the user clicks into a field, the cursor is shown briefly ... with the locking div, no field can be selected, except those that have values shown in them.
Jun 12 '06 #11
Zach
2 New Member
...or you could skip all that work, and fix the one mistake the person made in the first post.

This will work, if all you want to do is block access to everything in the page. It will work 100% of the time, and actually in any of todays browsers also.

Expand|Select|Wrap|Line Numbers
  1.  
  2. <img src="http://sportsforum.ws/blank.gif" 
  3.  
  4. style="width:100%;height:100%;position:absolute;top:0;left:0;zIndex:99999;" 
  5.  
  6. id="fsw">
  7.  
  8.  

Done :)
Jun 25 '06 #12
Zach
2 New Member
Well, this thing is bound and determined to break up left - so obviously, put it together.

This also allows for you to easily change if the page is reachable or not




document.getEle mentById('fsw') .style.display= "none"

now the page would be reachable





document.getEle mentById('fsw') .style.display= ""

now it wouldnt
Jun 25 '06 #13

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1752
by: Plumer | last post by:
Hello everyone, I am using MS .NET Framework 1.0 Version 1.0.3705 developing a C# client application using SQL Server on the server side. I am looking to implement drag & drop in a TreeView control. The operation takes place entirely within this single control. There is no need to provide for interaction with other controls, forms, applications etc. Both the drag source item (a TreeNode) and the drag target item (another TreeNode) are...
2
16321
by: JJ | last post by:
Hi All, I need to create a MouseDown event for a picture box . Am I doing the following right? pictureBox.MouseDown += new System.WinForms.MouseEventHandler(pictureBox_MouseDown) Then
4
4741
by: rsmith | last post by:
How can I capture the MouseDown event on a Label ? I entered thr following code and got a " cannot handle Event 'MouseDown' because they do not have the same signature." Private Sub Label1_MouseDown _ (ByVal sender As System.Object, ByVal e As System.EventArgs) _ Handles Label1.MouseDown
4
4533
by: Tom | last post by:
I have a VB.NET user control that I wrote - this control has three or four other controls on it (textbox, combobox, datetime picker, etc). Now, whenever the control is on a form and the user enters anything into the textbox (for instance) I trap the keypress event to handle some stuff (i.e. if it is an enter key, etc). Now, once I am done with handling the keypress event for the textbox, I then need to pass that keypress event BACK to the...
15
4057
by: Adam J. Schaff | last post by:
I have noticed that if a user closes a form via pressing return (either while the OK button has focus or if AcceptButton is set to OK for the form) then the "ENTER" keypress event fires ON THE CALLING FORM! This is very bad for me, because in my application, Form1 responds to an ENTER keypress by calling Form2. If the user closes Form2 via an ENTER, then Form1 just reopens it again, kind of trapping the user in Form2 (they can still close...
3
6864
by: Fia | last post by:
Hi In Visual Basic 6 I could call keypress with an integer of a choosen key. For example I could call a textbox's keypress with the number 13 (for the enter key). But now in Visual Basic .Net I don't know how I shall do to do the same thing. I have tried to send Keys.Numpad8, but then it complains about it cannot convert from Keys to keyEventArgs I have also tried to send the number 8, but then it complains it cannot convert from Integer...
5
8899
by: Steve | last post by:
In VB6 I have a screen the has a text box and a datagrid If I click the datagrid, the 1st event is to validate the textbox and then the 2nd event is a datagrid mousedown event. If a get an error message in the textbox validate it seems the mousedown event is never executed. In VB.Net it executes the textbox validation and then displays the error, but still executes the mousedown event. It appears that I have to explicitly...
4
2098
by: khalid galal | last post by:
Hi, i am having a problem with removing event handlers, it is when creating nested event handlers (an event handler raising another event handler) where a part of the code is private void toolStripButton1_Click(object sender, EventArgs e) { this.MouseDown += new System.Windows.Forms.MouseEventHandler(this.Form1_ MouseDown); } private void Form1_MouseDown(object sender, MouseEventArgs e) { this.MouseUp += new...
2
7716
by: svibuk | last post by:
i have a asp.net list box populated with databae data , autopostback = true wht i need is 1) when double clicked(double click event) i want it to be visible=false 2)i want to move between the data in the listbox using up, down arrow keys & make the selection by pressing eneter(keypress event) 3) everytime i move betwen the data(autopostback = true) postback is caused,is it possible to avoid the flickering without ajax as if i have to...
0
9643
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9480
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10147
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9946
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8968
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7494
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5379
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
3645
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2877
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.