473,387 Members | 1,766 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,387 software developers and data experts.

Dialog Handling Shortcut keys

Hi there,

I'm trying to handle some shortcut keys within my application and I
can't seem to get the code to work when you are trying to action
against a ctrl + other character.

I found a post
http://groups.google.co.uk/group/mic...cbc8062c107680
that appears to help a lot but it doesn't seem to work with the ctrl
key.

here's the snippet of code I am working with, which was modified from
the thread mentioned above:

protected override bool ProcessDialogKey(Keys keyData)
{
if (keyData == Keys.ControlKey && keyData == Keys.G)
{
ReassignAssessment();
}
else if (keyData == Keys.Insert)
{
ToggleReadUnread();
}

return base.ProcessDialogKey(keyData);
}

This method seems to be fired on every key press, so I don't even get
a chance to press "G" as the method has already fired on ctrl. Even
when I run without debugging it's showing no signs of executing.

The value of keydata when I do debug is 131089, which if I look at the
MSDN help could match to the value of Keys.Control (131072) +
Keys.ControlKey (17)

Are there any alternatives that I could try to get this to work?

Thanks,

Emma Middlebrook

May 24 '07 #1
1 2880
On May 24, 1:54 pm, Emma Middlebrook <e.middlebr...@googlemail.com>
wrote:
This method seems to be fired on every key press, so I don't even get
a chance to press "G" as the method has already fired on ctrl. Even
when I run without debugging it's showing no signs of executing.
You need to use:

if (keyData == (Keys.G | Keys.Control))
{
....
}

This will trigger if G and Ctrl are pressed, but won't trigger on:
Shift+G
G
Shift
Ctrl
Ctrl+Shift+G
Alt+G
etc

Jon

May 24 '07 #2

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

Similar topics

4
by: Maurice Mertens | last post by:
Hi, I'm trying to set shortcut keys for textboxes. But what is the best way to do this in VB.NET. In Access it was very simple, just put an "&" sign in the label that belongs to the textbox. But...
0
by: Saper\(ek\) | last post by:
this is a strange behavior of buttons with shortcut keys, when You have a datagrid on a form and some buttons with shortcut keys. When You click on the datagrid (anywhere but the cells, free space,...
9
by: Lars Netzel | last post by:
If I press the Key "a" on the keyboard, all the events and properites will only give me "65" as keycode.. and I want it to give me "a". If I use the KeyPress event.. then I will have access to...
2
by: philelpko | last post by:
Morning all, My database is now secure and hosted on the network and appears to be happily running thanks to several (hundred) posts on this site so thanks to everyone for the help. One person...
0
by: thirunavukarasukm | last post by:
Hai... How to Usercontrols with Shortcut Keys... I am creating one windows apllication.. the apllication contain many form.. in one form i am used one usercontrol(parent control)..
3
by: =?Utf-8?B?R3JlZw==?= | last post by:
I've been trying to figure out how to show a color dialog in VB.Net . I've come across the following code that shows it, but its not the advanced color dialog I am looking for. I know there is...
1
sujathaeeshan
by: sujathaeeshan | last post by:
Hi all, I need to provide shortcut keys for controls like text box and buttons etc... That is i dont want to go for tabspace or mouse click for perticular controls.. By having shortcut keys i...
11
by: VK | last post by:
In the continuation of the discussion at "Making Site Opaque -- This Strategy Feasible?" and my comment at http://groups.google.com/group/comp.lang.javascript/msg/b515a4408680e8e2 I have...
8
by: BD | last post by:
How can I duplicate the behavior of the operating system shortcut keys in my application? For example, my windows form has 5 controls (textboxes), the operating system will pickup which control...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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...

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.