Menu Shortcuts vs. editing keys in PropertyGrid

  • Thread starter Bruce Henderson
  • Start date
B

Bruce Henderson

I am using a PropertyGrid in a Form to edit a class with a
string property. I also have a MenuItem (Edit|Delete)
which has been assigned a shortcut for the delete key.

When various other controls in the form are focused, I
wish to respond to the Edit|Delete command, but when
editing the string in the PropertyGrid, I would expect the
delete key to be processed by the text editor window for
the string property inside the PropertyGrid.

Instead, the delete key is translated to a Click event on
the EditDelete MenuItem regardless of the state of the U/I.

This seems to me to be a frequently-occuring situation. Is
there some way to make this work as I have described?

Bruce
 
B

Bob Powell [MVP]

I just went through this same problem and had to specifically check that the
control had the focus or I ignored the delete.

I did this through the ProcessCommandKey override so that if I handled the
key I could signal this to the caller, if you don't handle it, it gets
passed on to the property grid which does the right thing with it.

--
Bob Powell [MVP]
C#, System.Drawing

September's edition of Well Formed is now available.
http://www.bobpowell.net/currentissue.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/gdiplus_faq.htm
 
B

Bruce Henderson

This solution worked for me.

Thanks, Bruce
-----Original Message-----
I just went through this same problem and had to specifically check that the
control had the focus or I ignored the delete.

I did this through the ProcessCommandKey override so that if I handled the
key I could signal this to the caller, if you don't handle it, it gets
passed on to the property grid which does the right thing with it.

--
Bob Powell [MVP]
C#, System.Drawing

September's edition of Well Formed is now available.
http://www.bobpowell.net/currentissue.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/gdiplus_faq.htm






.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top