VisualHint's blog

Navigate with the TAB key in a PropertyGrid

Navigate the PropertyGrid with the TAB key This feature is one of the most discussed about PropertyGrids in general, whether they are mfc, activeX or .net controls from third party developers. The model provided by Microsoft does not offer the possibility to navigate from value to value with the TAB key, or shift+TAB for reverse order and this is a lack that annoys a lot of people. One of my customers had a long discussion with me about this feature. He wanted absolutely this kind of navigation to help his end-user edit a long list of mandatory variables. Using Return and Escape plus the arrow keys was not enough to provide a good experience to his own customers. Since that time, several other visitors and customers asked me the same feature. After visiting some developer forums and articles, I was convinced that browsing property values with the TAB key would be a must for Smart PropertyGrid.Net. So here is what I came with:

  • You are now able to choose between two major modes. In the first one you need to validate or cancel the current edition of the value and use the arrow key to go to the next editable property. In the second one , you navigate to the next inplace control with TAB and to the previous with shift+TAB. There are also several non-exclusive options for all tastes:

  • The "TabKeyWithAutoFocus" option will focus inside an inplace control as soon as you click on a property label. This is a great way to minimize the actions required by the end-user.

  • The "TabKeyInSubControls" option will allow to access child components in inplace controls. For example, for a trackbar feel, TAB will first go in the textbox part and another TAB will jump to the slider.

  • The "TabKeyInChildProperties" option will open any collapsed hierarchy to place the focus in the next editable property value.

  • The "TabKeySkipReadonlyProperties" option will skip readonly properties. Without it, these properties are visited so that a clipboard copy operation is possible while navigating the grid with the keyboard.

  • At last, the "TabKeyLeavesAtExtremes" option will normally tab to the remaining controls in a form once the top or bottom properties are edited. Without it, the focus will continue to rotate in the PropertyGrid.

There will be a small sample available to showcase all those modes in a few days.