Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Using Ctrl+E menu shortcut
Message
From
25/06/2008 14:02:30
 
 
To
All
General information
Forum:
ASP.NET
Category:
Forms
Title:
Using Ctrl+E menu shortcut
Environment versions
Environment:
C# 2.0
Miscellaneous
Thread ID:
01326710
Message ID:
01326710
Views:
67
If focused control is ReadOnly, menu shortcut key is ignored.

To reproduce, run code below, press Ctrl+E.
Note that message box does not appear.

This issue blocks Ctrl+E usage in application.
How to fix ?

Andrus.


using System;
using System.Windows.Forms;

static class Program
{
static void Main()
{
Application.Run(new Form1());
}
}

class Form1 : Form
{
public Form1()
{
menuStrip1 = new MenuStrip();
fileToolStripMenuItem = new ToolStripMenuItem();
openToolStripMenuItem = new ToolStripMenuItem();
textBox1 = new TextBox();
menuStrip1.Items.AddRange(new ToolStripItem[] { fileToolStripMenuItem });
fileToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { openToolStripMenuItem });
fileToolStripMenuItem.Text = "File";
openToolStripMenuItem.ShortcutKeys = ((Keys)((Keys.Control | Keys.E)));
openToolStripMenuItem.Text = "Open";
openToolStripMenuItem.Click += new System.EventHandler(openToolStripMenuItem_Click);
textBox1.Location = new System.Drawing.Point(55, 150);
textBox1.ReadOnly = true;
Controls.Add(textBox1);
Controls.Add(menuStrip1);
MainMenuStrip = menuStrip1;
}

void openToolStripMenuItem_Click(object sender, EventArgs e)
{
MessageBox.Show("Clicked");
}

MenuStrip menuStrip1;
ToolStripMenuItem fileToolStripMenuItem;
ToolStripMenuItem openToolStripMenuItem;
TextBox textBox1;
}
Andrus
Next
Reply
Map
View

Click here to load this message in the networking platform