Menu Shortcuts vs. editing keys in PropertyGrid

  • Thread starter Thread starter Bruce Henderson
  • Start date 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
 
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
 
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






.
 
Back
Top