|
-
Feb 21st, 2008, 01:40 PM
#1
Thread Starter
Lively Member
[2005] Mouse and keyboard events(help and explanation needed)
I was wondering if it is possible to have overall mouse and keyboard events.
I made a member system with magnetic cards for a discotheek here but there is a problem i realy want to solve.
Cause the cardreaders are keyboard wedges so they just send out keys and presses enter when there is no more data.
Now on my entrance screen i have just 1 focuseble object and thats a textboxt. With the standard code:
Code:
Private Sub Textbox_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles Textbox.KeyPress
Console.WriteLine("Pressed : " & e.KeyChar)
End Sub
This way i can perfecly see wich char is pressed but i always need a stupid textbox in my screen with the focus on it.
I have the same system in my 'search member' window but still then i first need to focus on the specific textbox.
Isnt there some event that always fires when i press a key?
And then i have exctualy the question for the mouse press events.
I made a full screen game once when i was still @ school(still am but different now) and even then i needed a form to be able to listen to those events.
I dont want to depend on windows controls only :@
This is probably goeing to be API work wich i never did before.
I hope anyone can help.
Greets
-
Feb 21st, 2008, 01:48 PM
#2
Re: [2005] Mouse and keyboard events(help and explanation needed)
set the forms KeyPreview property to true. This will make Keyboard events filter through the forms Key events (like keypress, keydown, keyup) prior to being filtered to the actual control that has focus.
-
Feb 21st, 2008, 05:41 PM
#3
Thread Starter
Lively Member
Re: [2005] Mouse and keyboard events(help and explanation needed)
Owh thats quite easy indeed :P
Never thought it would be that easy lol.
Is there anything like that to do the same with mouse click events?
Greets
-
Feb 21st, 2008, 08:04 PM
#4
Re: [2005] Mouse and keyboard events(help and explanation needed)
 Originally Posted by ovanwijk
Owh thats quite easy indeed :P
Never thought it would be that easy lol.
Is there anything like that to do the same with mouse click events?
Greets
No, but you can just use a single method to handle the Click or MouseClick event for the form itself and one or more child controls.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|