473,395 Members | 1,869 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Catch a user pressing Alt-K

>From a previous post you guys may be aware I'm writing a component
which is a text box and icon inside a panel. I want to detect when a
user presses Alt+K together so I can throw up a dialog.

It's basically identical to how the Alt-K feature works in the To and
CC fields of Microsoft Outlook. I was going to use this code to detect
the event:

Private Sub completerCatcher(ByVal sender As Object, ByVal e As
KeyPressEventArgs)
If (Char.ToLower(e.KeyChar) = "k" And
My.Computer.Keyboard.AltKeyDown) Then
activatePicker(Nothing, Nothing)
End If
End Sub

Now I'd imagine this would work, only it doesn't fire when the user
presses Alt+K. I imagine it's handled by the parent form. Since my
component is used on multiple dialogs (and sometimes many times per
single dialog) I need to know how I can catch these events.

Does anybody know?

Aug 29 '07 #1
1 1458
On Aug 29, 1:40 pm, Phillip Taylor <Phillip.Ross.Tay...@gmail.com>
wrote:
From a previous post you guys may be aware I'm writing a component

which is a text box and icon inside a panel. I want to detect when a
user presses Alt+K together so I can throw up a dialog.

It's basically identical to how the Alt-K feature works in the To and
CC fields of Microsoft Outlook. I was going to use this code to detect
the event:

Private Sub completerCatcher(ByVal sender As Object, ByVal e As
KeyPressEventArgs)
If (Char.ToLower(e.KeyChar) = "k" And
My.Computer.Keyboard.AltKeyDown) Then
activatePicker(Nothing, Nothing)
End If
End Sub

Now I'd imagine this would work, only it doesn't fire when the user
presses Alt+K. I imagine it's handled by the parent form. Since my
component is used on multiple dialogs (and sometimes many times per
single dialog) I need to know how I can catch these events.

Does anybody know?
Don't worry guys. I did it. I need to use KeyPreview instead.

Private Sub completerCatcher(ByVal sender As Object, ByVal e As
PreviewKeyDownEventArgs)
If (e.Alt And e.KeyValue = 75) Then
activatePicker(Nothing, Nothing)
End If
End Sub

Aug 29 '07 #2

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

Similar topics

6
by: Paul Gorodyansky | last post by:
Hi, Question about event.altKey event.ctrlKey event.shiftKey If I need to catch when a user does say Ctrl+Alt+G - somehow event.altKey is not working, i.e.:
8
by: Kreedz | last post by:
Hi I've got some really weird issue with a sizer, a text field and a notebook. Here's an example: import wx class A(wx.Panel): def __init__(self, parent, id): wx.Panel.__init__(self,...
1
by: richard | last post by:
i want to add shorcuts like ALT+M or CTRL+k to my windows application. is it posible to define shortcuts and catch them? Thanks Richard
1
by: Jay Douglas | last post by:
I'm writing a application that is a lot like a macro in C#. Basically, when a user presses a certain key, the software needs to generate a series of keystrokes. I have the code written that...
11
by: trinitypete | last post by:
Hi all, I have a user control that uses control literal to build a heading with a link, and a div containing links below. As the link heading is hit, I want to change the style of the div,...
9
by: Mahesh Devjibhai Dhola | last post by:
Hi all, The following are my need: 1. When a PC starts, my software should come up directly without any user interaction. 2. Only my software will be accessible to the user and they will not be...
2
by: J | last post by:
Hello. I apologize if this isn't the appropriate group for this question but I was wondering if it's possible to allow regular windows domain users to change their passwords through an .asp page? ...
11
by: Tantr Mantr | last post by:
I want to convert a string to a DateTime type. The user can enter the date in various formats and I am not sure if it will be a valid Date. Is it possible to check if a string can be converted to a...
1
by: vimala5 | last post by:
code for closing a window using ALT f4 or pressing cross button using javascript
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
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...

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.