473,804 Members | 3,018 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Help overriding key combination on datagrid

I'm tring to override the combination all the combination like this one Ctrl
+ Shift + [another key]. I just can't catch it... I have already done this
for ctrl + [any other key] or Shift + [any other key] but for both at same
timeI can't do it....

Can someone tell me how to do it
Here is an example of how I am doing this:
if ((msg.Msg == WM_KEYDOWN) && (keyCode == Keys.Down))
{
if (Control.Modifi erKeys == Keys.Shift)
{
return true;
}
}
Nov 17 '05 #1
1 1775
Hi Diago,
I would create a control that inherits from DataGrid then override the
ProcessCmdKey method to catch your key combination. The keyData field is a
logical ORing of all currently pressed keys, so an example of how to catch a
Ctrl + Shift + P key combination pressed by the user is given below:

protected override bool ProcessCmdKey(r ef Message msg, Keys keyData)
{
//Want to catch ctrl + shift + P
Keys keyCombination = Keys.Control | Keys.Shift | Keys.P;

if ((keyData & keyCombination) == keyCombination)
{
//do whatever you want to do.
}

return false;
}

Hope that helps
Mark R Dawson
http://www.markdawson.org

"Diogo Alves - Software Developer" wrote:
I'm tring to override the combination all the combination like this one Ctrl
+ Shift + [another key]. I just can't catch it... I have already done this
for ctrl + [any other key] or Shift + [any other key] but for both at same
timeI can't do it....

Can someone tell me how to do it
Here is an example of how I am doing this:
if ((msg.Msg == WM_KEYDOWN) && (keyCode == Keys.Down))
{
if (Control.Modifi erKeys == Keys.Shift)
{
return true;
}
}

Nov 17 '05 #2

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

Similar topics

1
1735
by: Dietmar Gräbner | last post by:
Hi Right now I'm dealing with derivation by restriction and I have some questions concerning the attribute property use in context of the derivation. Consider following Schema: <xs:schema elementFormDefault="qualified" attributeFormDefault="unqualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
2
1951
by: Dmitry Karneyev | last post by:
Hi! I'm using DataGrid in windows form. I need to implement the following functionality: - any mouse must select a row according where mouse has been clicked - context menu must be also availiable by right mouse click Have you got any ideas? Thanks for any advice.
0
929
by: VM | last post by:
Is there any way to override the event that adds an empty row to the datagrid when I click on the Tab key? Instead of adding the row to the datagrid, I'd like it to run a user-defined method. If that's not possible, then I'd like to disable the adding of the row without having to make the grid read-only. Thanks.
2
1130
by: chuckdfoster | last post by:
I have an database with a list of deparments (tblDepts). I need a web page that lists these departments with a textbox beside them for a score. I then need the user to score each department and press submit which would put all of these scores into a scores table (tblScores). Can someone help me get started on this? I know that you can make a datagrid have a blank textbox column, but I'm confused about how to get that data into a...
6
2682
by: Mike | last post by:
Hi, I have such problem: On my form I have TabControl. I want to move from one tab to another using "Next" and "Prev" button. This part works fine. But control also supports switching between TabPagess using combination of buttons Ctrl+Tab (forward) and Ctrl+Shift+Tab (back). I would like to suppress such possibility.
4
5965
by: Phill. W | last post by:
Here's a knotty little problem. I have some nasty little controls that needs to behave in a non- windows-Standard way - don't ask why; it's a large application being converted from some older code and my users are adamant that this behaviour mustn't change. Specifically, I want to be able to set myControl.Enabled = False
0
1115
by: Greg | last post by:
I've made a standard datagrid multi line. However, the mutiple lines of text are only visible when a row is selected. This is a common issue and the solution offered is always to override the painttext method, or even the paint method. However, I can't find any tips for going about this. I am already overriding my paint method for the text columns (to add other functionality) , so I know I don't have to add too much more. Anybody got...
1
2902
by: tshad | last post by:
I have a DataGrid where I want the text in the cells to be black. But I want the header to have a black background and white text. The problem is the settings in the DataGrid are not overriding the Css files (which is in a User Control). The Css file (in the .aspx file) has the following lines: td { font-family: Verdana, Arial, Helvetica, sans-serif;
2
1085
by: cus129 | last post by:
Help Please!!!!!!!! I am using VS 2003 and developing windows application. My question is how to highlight or change the color of the whole row in a DataGrid when a criteria is met on form load? For e.g I have 5 different columns in a datagrid and one of them is "Active". If Active is "Yes", the whole row should be highlighted. I have been able to highlight a cell through overriding the paint method but not the row. Thanks in...
0
9579
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
10578
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10332
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
9152
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
7620
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
5522
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...
1
4300
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3820
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2991
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.