473,606 Members | 2,877 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Shortcuts don't work.

With ToolStripMenuIt em objects i created a 'Tools' menu and from that
menu droped an Item to which i assigned a ShortcutKey of 'Keys.Control
| Keys.E', and the shortcut doesn't work.
This ToolStripMenuIt em is inside a Form, i tryed with different
shortcuts and some work, some don't.
For instance, 'Keys.Control | Keys.R' doesn't work either.
Is anyone familiar with this problem?

MenuStrip msMenu = new MenuStrip();
msMenu.Parent = this;

ToolStripMenuIt em miFile = new ToolStripMenuIt em("&File");
ToolStripMenuIt em miTools = new ToolStripMenuIt em("&Tools");

ToolStripMenuIt em miExit = new ToolStripMenuIt em("E&xit", null, new
EventHandler(mi ExitOnClick));
ToolStripMenuIt em miInsert = new ToolStripMenuIt em("&Insert", null, new
EventHandler(mi InsertOnClick)) ;
miInsert.Shortc utKeys = Keys.Control | Keys.I;
ToolStripMenuIt em miEdit = new ToolStripMenuIt em("&Edit", null, new
EventHandler(mi EditOnClick));
miEdit.Shortcut Keys = Keys.Control | Keys.E;
ToolStripMenuIt em miDelete = new ToolStripMenuIt em("&Delete", null, new
EventHandler(mi DeleteOnClick)) ;
miDelete.Shortc utKeys = Keys.Control | Keys.D;

miFile.DropDown Items.Add(miExi t);
msMenu.Items.Ad d(miFile);
miTools.DropDow nItems.Add(miIn sert);
miTools.DropDow nItems.Add(miEd it);
miTools.DropDow nItems.Add(miDe lete);
msMenu.Items.Ad d(miTools);

Oct 29 '06 #1
5 6539
Hi,

I can't repro the issue. I pasted the code you supplied into a new Form right
after InitializeCompo nent() is called, and then created event handlers that
simply displayed a MessageBox.

Pressing any of the key combinations defined as shortcuts displayed a
MessageBox as expected. Ctrl+I, Ctrl+E, Ctrl+D and even Ctrl+R all worked
just fine. I didn't try any other combinations.

I suspect that there may be some shortcut conflict somewhere or another
control is preventing the key combination from working. Make sure that you
haven't coded any key handlers that might prevent them from working and try
removing components and controls from your Form until the issue goes away,
just to see which control is causing the conflict (if in fact it is a conflict
issue).

--
Dave Sexton

<PA******@gmail .comwrote in message
news:11******** *************@e 64g2000cwd.goog legroups.com...
With ToolStripMenuIt em objects i created a 'Tools' menu and from that
menu droped an Item to which i assigned a ShortcutKey of 'Keys.Control
| Keys.E', and the shortcut doesn't work.
This ToolStripMenuIt em is inside a Form, i tryed with different
shortcuts and some work, some don't.
For instance, 'Keys.Control | Keys.R' doesn't work either.
Is anyone familiar with this problem?

MenuStrip msMenu = new MenuStrip();
msMenu.Parent = this;

ToolStripMenuIt em miFile = new ToolStripMenuIt em("&File");
ToolStripMenuIt em miTools = new ToolStripMenuIt em("&Tools");

ToolStripMenuIt em miExit = new ToolStripMenuIt em("E&xit", null, new
EventHandler(mi ExitOnClick));
ToolStripMenuIt em miInsert = new ToolStripMenuIt em("&Insert", null, new
EventHandler(mi InsertOnClick)) ;
miInsert.Shortc utKeys = Keys.Control | Keys.I;
ToolStripMenuIt em miEdit = new ToolStripMenuIt em("&Edit", null, new
EventHandler(mi EditOnClick));
miEdit.Shortcut Keys = Keys.Control | Keys.E;
ToolStripMenuIt em miDelete = new ToolStripMenuIt em("&Delete", null, new
EventHandler(mi DeleteOnClick)) ;
miDelete.Shortc utKeys = Keys.Control | Keys.D;

miFile.DropDown Items.Add(miExi t);
msMenu.Items.Ad d(miFile);
miTools.DropDow nItems.Add(miIn sert);
miTools.DropDow nItems.Add(miEd it);
miTools.DropDow nItems.Add(miDe lete);
msMenu.Items.Ad d(miTools);

Oct 29 '06 #2
I had a TextBox object also on the same form, i removed it and the
problem went away, thank you for the sugestion.
I have been told that focus can sometimes trigger these problems, and
the TB did indeed have the focus, so some TB shortcut might be
conflicting with my own.

Dave Sexton wrote:
Hi,

I can't repro the issue. I pasted the code you supplied into a new Form right
after InitializeCompo nent() is called, and then created event handlers that
simply displayed a MessageBox.

Pressing any of the key combinations defined as shortcuts displayed a
MessageBox as expected. Ctrl+I, Ctrl+E, Ctrl+D and even Ctrl+R all worked
just fine. I didn't try any other combinations.

I suspect that there may be some shortcut conflict somewhere or another
control is preventing the key combination from working. Make sure that you
haven't coded any key handlers that might prevent them from working and try
removing components and controls from your Form until the issue goes away,
just to see which control is causing the conflict (if in fact it is a conflict
issue).

--
Dave Sexton

<PA******@gmail .comwrote in message
news:11******** *************@e 64g2000cwd.goog legroups.com...
With ToolStripMenuIt em objects i created a 'Tools' menu and from that
menu droped an Item to which i assigned a ShortcutKey of 'Keys.Control
| Keys.E', and the shortcut doesn't work.
This ToolStripMenuIt em is inside a Form, i tryed with different
shortcuts and some work, some don't.
For instance, 'Keys.Control | Keys.R' doesn't work either.
Is anyone familiar with this problem?

MenuStrip msMenu = new MenuStrip();
msMenu.Parent = this;

ToolStripMenuIt em miFile = new ToolStripMenuIt em("&File");
ToolStripMenuIt em miTools = new ToolStripMenuIt em("&Tools");

ToolStripMenuIt em miExit = new ToolStripMenuIt em("E&xit", null, new
EventHandler(mi ExitOnClick));
ToolStripMenuIt em miInsert = new ToolStripMenuIt em("&Insert", null, new
EventHandler(mi InsertOnClick)) ;
miInsert.Shortc utKeys = Keys.Control | Keys.I;
ToolStripMenuIt em miEdit = new ToolStripMenuIt em("&Edit", null, new
EventHandler(mi EditOnClick));
miEdit.Shortcut Keys = Keys.Control | Keys.E;
ToolStripMenuIt em miDelete = new ToolStripMenuIt em("&Delete", null, new
EventHandler(mi DeleteOnClick)) ;
miDelete.Shortc utKeys = Keys.Control | Keys.D;

miFile.DropDown Items.Add(miExi t);
msMenu.Items.Ad d(miFile);
miTools.DropDow nItems.Add(miIn sert);
miTools.DropDow nItems.Add(miEd it);
miTools.DropDow nItems.Add(miDe lete);
msMenu.Items.Ad d(miTools);
Oct 29 '06 #3
I disabled the shortcuts on the TextBox and the shortcuts previously
mentioned still wouldn't work. They work if i change Enabled to false.

PA******@gmail. com wrote:
I had a TextBox object also on the same form, i removed it and the
problem went away, thank you for the sugestion.
I have been told that focus can sometimes trigger these problems, and
the TB did indeed have the focus, so some TB shortcut might be
conflicting with my own.

Dave Sexton wrote:
Hi,

I can't repro the issue. I pasted the code you supplied into a new Form right
after InitializeCompo nent() is called, and then created event handlers that
simply displayed a MessageBox.

Pressing any of the key combinations defined as shortcuts displayed a
MessageBox as expected. Ctrl+I, Ctrl+E, Ctrl+D and even Ctrl+R all worked
just fine. I didn't try any other combinations.

I suspect that there may be some shortcut conflict somewhere or another
control is preventing the key combination from working. Make sure that you
haven't coded any key handlers that might prevent them from working and try
removing components and controls from your Form until the issue goes away,
just to see which control is causing the conflict (if in fact it is a conflict
issue).

--
Dave Sexton

<PA******@gmail .comwrote in message
news:11******** *************@e 64g2000cwd.goog legroups.com...
With ToolStripMenuIt em objects i created a 'Tools' menu and from that
menu droped an Item to which i assigned a ShortcutKey of 'Keys.Control
| Keys.E', and the shortcut doesn't work.
This ToolStripMenuIt em is inside a Form, i tryed with different
shortcuts and some work, some don't.
For instance, 'Keys.Control | Keys.R' doesn't work either.
Is anyone familiar with this problem?
>
MenuStrip msMenu = new MenuStrip();
msMenu.Parent = this;
>
ToolStripMenuIt em miFile = new ToolStripMenuIt em("&File");
ToolStripMenuIt em miTools = new ToolStripMenuIt em("&Tools");
>
ToolStripMenuIt em miExit = new ToolStripMenuIt em("E&xit", null, new
EventHandler(mi ExitOnClick));
ToolStripMenuIt em miInsert = new ToolStripMenuIt em("&Insert", null, new
EventHandler(mi InsertOnClick)) ;
miInsert.Shortc utKeys = Keys.Control | Keys.I;
ToolStripMenuIt em miEdit = new ToolStripMenuIt em("&Edit", null, new
EventHandler(mi EditOnClick));
miEdit.Shortcut Keys = Keys.Control | Keys.E;
ToolStripMenuIt em miDelete = new ToolStripMenuIt em("&Delete", null, new
EventHandler(mi DeleteOnClick)) ;
miDelete.Shortc utKeys = Keys.Control | Keys.D;
>
miFile.DropDown Items.Add(miExi t);
msMenu.Items.Ad d(miFile);
miTools.DropDow nItems.Add(miIn sert);
miTools.DropDow nItems.Add(miEd it);
miTools.DropDow nItems.Add(miDe lete);
msMenu.Items.Ad d(miTools);
>
Oct 29 '06 #4
The full code btw.

using System;
using System.Windows. Forms;

class GUDB : Form
{
private TextBox tbOutput = new TextBox();

public static void Main()
{
Application.Run (new GUDB());
}
public GUDB()
{
Text = "GUDB";

tbOutput.Parent = this;
tbOutput.Multil ine = true;
tbOutput.ReadOn ly = true;
tbOutput.Dock = DockStyle.Fill;
tbOutput.Scroll Bars = ScrollBars.Vert ical;
tbOutput.WordWr ap = true;

MenuStrip msMenu = new MenuStrip();
msMenu.Parent = this;

ToolStripMenuIt em miFile = new ToolStripMenuIt em("&File");
ToolStripMenuIt em miTools = new ToolStripMenuIt em("&Tools");

ToolStripMenuIt em miExit = new ToolStripMenuIt em("E&xit", null, new
EventHandler(mi ExitOnClick));
ToolStripMenuIt em miInsert = new ToolStripMenuIt em("&Insert", null,
new EventHandler(mi InsertOnClick)) ;
miInsert.Shortc utKeys = Keys.Control | Keys.I;
ToolStripMenuIt em miEdit = new ToolStripMenuIt em("&Edit", null, new
EventHandler(mi EditOnClick));
miEdit.Shortcut Keys = Keys.Control | Keys.E;
ToolStripMenuIt em miDelete = new ToolStripMenuIt em("&Delete", null,
new EventHandler(mi DeleteOnClick)) ;
miDelete.Shortc utKeys = Keys.Control | Keys.D;

miFile.DropDown Items.Add(miExi t);
msMenu.Items.Ad d(miFile);
miTools.DropDow nItems.Add(miIn sert);
miTools.DropDow nItems.Add(miEd it);
miTools.DropDow nItems.Add(miDe lete);
msMenu.Items.Ad d(miTools);
}

private void miExitOnClick(o bject sender, EventArgs ea)
{
Close();
}

private void miInsertOnClick (object sender, EventArgs ea)
{
Close();
}

private void miEditOnClick(o bject sender, EventArgs ea)
{
Close();
}

private void miDeleteOnClick (object sender, EventArgs ea)
{
Close();
}
}

Oct 29 '06 #5
Hi,

I wonder if that's a bug. Setting ShorcutsEnabled to false should bubble the
key press to the Parent, IMO. I was able to repro that it doesn't.

Setting Enabled to false makes sense, however, because the TextBox isn't
receiving the key input to begin with.

I guess you'll have to do some research on the web to see if there are any
existing solutions. I assume that some people override WndProc and try to
handle the specific shortcuts that aren't working by checking if the
ActiveControl is a TextBox and then switching over the shortcuts that are
required such as Ctrl+E and Ctrl+R. Then invoke the appropriate menu command
in code for the current shortcut.

HTH

--
Dave Sexton

<PA******@gmail .comwrote in message
news:11******** **************@ b28g2000cwb.goo glegroups.com.. .
>I disabled the shortcuts on the TextBox and the shortcuts previously
mentioned still wouldn't work. They work if i change Enabled to false.

PA******@gmail. com wrote:
>I had a TextBox object also on the same form, i removed it and the
problem went away, thank you for the sugestion.
I have been told that focus can sometimes trigger these problems, and
the TB did indeed have the focus, so some TB shortcut might be
conflicting with my own.

Dave Sexton wrote:
Hi,

I can't repro the issue. I pasted the code you supplied into a new Form
right
after InitializeCompo nent() is called, and then created event handlers
that
simply displayed a MessageBox.

Pressing any of the key combinations defined as shortcuts displayed a
MessageBox as expected. Ctrl+I, Ctrl+E, Ctrl+D and even Ctrl+R all
worked
just fine. I didn't try any other combinations.

I suspect that there may be some shortcut conflict somewhere or another
control is preventing the key combination from working. Make sure that
you
haven't coded any key handlers that might prevent them from working and
try
removing components and controls from your Form until the issue goes
away,
just to see which control is causing the conflict (if in fact it is a
conflict
issue).

--
Dave Sexton

<PA******@gmail .comwrote in message
news:11******** *************@e 64g2000cwd.goog legroups.com...
With ToolStripMenuIt em objects i created a 'Tools' menu and from that
menu droped an Item to which i assigned a ShortcutKey of 'Keys.Control
| Keys.E', and the shortcut doesn't work.
This ToolStripMenuIt em is inside a Form, i tryed with different
shortcuts and some work, some don't.
For instance, 'Keys.Control | Keys.R' doesn't work either.
Is anyone familiar with this problem?

MenuStrip msMenu = new MenuStrip();
msMenu.Parent = this;

ToolStripMenuIt em miFile = new ToolStripMenuIt em("&File");
ToolStripMenuIt em miTools = new ToolStripMenuIt em("&Tools");

ToolStripMenuIt em miExit = new ToolStripMenuIt em("E&xit", null, new
EventHandler(mi ExitOnClick));
ToolStripMenuIt em miInsert = new ToolStripMenuIt em("&Insert", null, new
EventHandler(mi InsertOnClick)) ;
miInsert.Shortc utKeys = Keys.Control | Keys.I;
ToolStripMenuIt em miEdit = new ToolStripMenuIt em("&Edit", null, new
EventHandler(mi EditOnClick));
miEdit.Shortcut Keys = Keys.Control | Keys.E;
ToolStripMenuIt em miDelete = new ToolStripMenuIt em("&Delete", null, new
EventHandler(mi DeleteOnClick)) ;
miDelete.Shortc utKeys = Keys.Control | Keys.D;

miFile.DropDown Items.Add(miExi t);
msMenu.Items.Ad d(miFile);
miTools.DropDow nItems.Add(miIn sert);
miTools.DropDow nItems.Add(miEd it);
miTools.DropDow nItems.Add(miDe lete);
msMenu.Items.Ad d(miTools);

Oct 29 '06 #6

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

Similar topics

0
1777
by: pbrenon | last post by:
Hello everybody, I try to install php on a 2003 server and IIS6 and It doesn't work. I had modified the mime type of the IIS server, i'd used phpinstaller one time and another time i'd do it manually to configure the server but it don't work better. Everybody have full access with ntfs on the directory which contain php.exe and the directory wich contain the script and, it can't work. What can i do ?
0
1542
by: Paul C | last post by:
Hello, everybody. I am having trouble running some of the VS.NET samples, specifically the CarSelector web app, which is very simple. The symptom is that the web controls (drop down listboxes and such) do not render correctly. They're almost invisible, and the others don't work at all, but just show their caption text. Not what should happen This strange behavior is happening on my new laptop, which came with XP Home, but I immediately...
3
3042
by: Douglas Buchanan | last post by:
Buttons don't work if form is opened on startup A2k If 'frmMain' is set to open by default at startup none of the buttons work. If 'frmMain' is opened from the database window then all the buttons work. The form's name ('frmMain') is selected from in the Startup dialog box.
4
2077
by: Paul T. RONG | last post by:
Dear All, I add two new tables to the database and then the disable shift key codes don't work. These two new tables are actually created by two queries, and only these two are in the front end, I didn't manage to move them to the back end. I work with Access 2k under Win XP. these are the codes that don't work (it worked for more than a year very well):
0
1265
by: faktujaa | last post by:
XML Comment tags (except summary, remarks, param and returns) don't work in my small trial program. The comment tags i want to work are see, seealso, exception, etc. But none of them work. I tried some code from net but no help. Do i have to do some extra settings in the project to make them work. please help. Please check the code below. I don't think i have done any mistakes. Using this code, i build Comment Web Pages and was not able to see...
6
8848
by: Chris Anderson | last post by:
Anyone know of a fix (ideally) or an easy workaround to the problem of escape characters not working in regex replacement text? They just come out as literal text For example, you'd think that thi Regex.Replace("<stuff>text</stuff>", "<stuff>", "<stuff>\n" would give yo <stuff text</stuff
0
909
by: Shlomit | last post by:
Hi, I work in VB and in VB via excel and the roll of the mouse don't work. How can I fix it will work?
1
1819
by: Mark | last post by:
I have a main form which is linked to a table. I have also placed a sub form on this main form. For some reason I can't control the subform for example the scroll bars do not work, the record selectors don't work. The subform works correctly when opened as a the main form. Any suggestions on why this is happening would be a great help.
1
1927
by: Gustavo Narea | last post by:
Hello, everyone. Why do unitest.TestCase grand-grandchildren not work? I've created a unittest.TestCase descendant, which contains the setUp() and tearDown() for testing some components of a web framework. Every application based on this framework should subclass this base class once, and the rest of the test cases must also subclass the base TestCase of the application (which is a direct descendant of my descendant of TestCase).
0
8031
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
7962
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,...
1
8107
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8315
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
6792
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
5971
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
5467
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
3989
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1565
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.