No, OnKeyDown() shouldn't be called for the PropertyGrid. The
PropertyGrid acts as a container (the PropertyGrid class) and is
composed of the toolstrip, the internal grid and the label (comment
area). When the internal grid has the focus, it receives the keyboard
events and handle them. The parent container's virtual methods like
OnKeyDown won't be called simply because the keystrokes are not
directed to it. To be aware of the keys typed, you can override
ProcessKeyPreview or subscribe to the events of the internal grid
(Controls[2].KeyDown += ......). But not that in the second
possibility, the keys will still be handled by the child. In the first
solution you can "eat" the keys messages.
So, this is what happens normally. However I agree that MS should have
provided a way to make the container aware of these events in a more
"natural" way. FYI, SPG forwards the events automatically to the
parent.
Concerning localization, neither SPG or MSPG support a particular
language. This is up to the client application to load the correct
strings and to supply them via Description and DisplayName attributes.
Note that SPG also enables on the fly modification of these
properties.
Hope that helps.
Best regards,
Nicolas Cadilhac @ VisualHint (
http://www.visualhint.com)
Home of Smart PropertyGrid for .Net and MFC
Microsoft PropertyGrid Resource List -
http://www.propertygridresourcelist.com
On Apr 12, 5:43 pm, "Larry Smith" <no_spam@_nospam.comwrote:
Thanks again for the feedback.
Why do you say it's abnormal? The internal grid has the focus so this
is absolutely normal that it gets the keyboard events.
I say it's abnormal because an "OnKeyDown()" override should be called
AFAIK. It's a published function which originates from the "Control" base
class no less. Unless I'm missing something I don't see why it's not being
called.
Indeed I think you're better to rely on a public solution. But you
should override ProcessKeyPreview instead of ProcessCmdKey which is
more intended for command keys (accelerator and menu shortcuts).
ProcessKeyPreview gives the opportunity to the parent to process the
key before or instead of the child.
My control is self-contained so it needs to handle its own keystrokes. I've
already played with "ProcessKeyPreview()" but will take another look. Since
it's low-level however I figured that "OnKeyDown()" was likely more
appropriate. The variety of keystroke functions/properties available is
bewildering given the absence of adequate documentation.
Concerning colors, you won't be able to change them on a per property
basis. Sorry for the plug but only a solution like Smart PropertyGrid
will let you customize most of the aspects of the grid. Getting into
the internals of the MSPG has its limits.
You're right of course and I'm puzzled why MSFT never gave us control over
this (color, font, etc.). It's basic. It's also particularly important for
my own app so I'll likely replace "PropertyGrid" by the second release
(first release is pending this fall). Note that I didn't pursue your own
control for a variety of reasons not the least of which is that it came to
my attention too late. I also require localization in potentially many
languages. What languages does yours support? Note BTW (FYI) that Mark
Rideout (manager of the "DataGridView" control at MSFT) has also posted
this:
http://blogs.msdn.com/markrideout/ar...08/510700.aspx
It's unofficial and likely needs work (haven't looked at it in detail) but
it serves as an excellent starting point to replace the "PropertyGrid"
(IMO). Thanks again for your help.