Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Using Ctrl+E menu shortcut
Message
De
29/06/2008 12:35:19
 
 
À
25/06/2008 14:02:30
Information générale
Forum:
ASP.NET
Catégorie:
Formulaires
Versions des environnements
Environment:
C# 2.0
Divers
Thread ID:
01326710
Message ID:
01327519
Vues:
10
>If focused control is ReadOnly, menu shortcut key is ignored.

No, menu shortcut keys are not ignored. I suspect it's because your shortcut key is Ctrl+E, which typically means "Edit". Since you've got a ReadOnly textbox, you can't edit it. I tried this with a different shortcut key and it works fine.

Your menuitem is openToolStripMenuItem ... why would you use Ctrl+E for Open? The only reason I can think of is that perhaps the word for "Open" in Estonian starts with an "E"? Can you use a different Ctrl-key combination or do you actually need to find a workaround for this?

~~Bonnie




>
>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;
>}
Bonnie Berent DeWitt
NET/C# MVP since 2003

http://geek-goddess-bonnie.blogspot.com
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform