Skip to content

Commit

Permalink
docs: update docs on context menu ShortcutKeys issue
Browse files Browse the repository at this point in the history
Closes #328.
  • Loading branch information
dwmkerr committed Jun 10, 2020
1 parent ce45eef commit 378a1a7
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 17 deletions.
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ SharpShell makes it easy to create Windows Shell Extensions using the .NET Frame
* [Enabling Logging](#enabling-logging)
* [CI/CD](#cicd)
* [Creating a Release](#creating-a-release)
* [Documentation](#documentation)
* [Contributor Guide](#contributor-guide)
* [Testimonials](#testimonials)
* [Projects that use SharpShell](#projects-that-use-sharpshell)
Expand Down Expand Up @@ -213,6 +214,16 @@ To create a release:

AppVeyor will build and publish a new NuGet package and as long as a new semver tag is pushed.

## Documentation

Documentation is still work in progress, and any contributions would be most welcome!

- [COM Server Associations](./docs/com-server-associations.md)
- [Context Menus](./docs/context-menu.md)
- [Managed Shell Extensions](./docs/managed-shell-extensions.md)
- [Logging](./docs/logging/logging.md)
- [Troubleshooting](./docs/troubleshooting.md)

## Contributor Guide

The project is maintained by the following group:
Expand Down
29 changes: 29 additions & 0 deletions docs/context-menu.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,16 @@ Shell Context Menus are Shell Extensions that add to the context menu opened whe

Shell Context Menus are fully supported in SharpShell. This section describes how to implement them.


<!-- vim-markdown-toc GFM -->

* [Creating Shell Context Menus](#creating-shell-context-menus)
* [Icons](#icons)
* [Shortcut Keys](#shortcut-keys)
* [Troubleshooting](#troubleshooting)

<!-- vim-markdown-toc -->

## Creating Shell Context Menus

Create a C# class library project. Ensure the class library is signed with a strong name. Add a reference to 'SharpShell' (the SharpShell core library is available from the Downloads page, or can be found on Nuget with a search for 'SharpShell'). If the library has been referenced manually, also add references to:
Expand Down Expand Up @@ -74,6 +84,25 @@ As a note, if the source of a context menu item's icon is a file format that sup

![Context Menu Screenshot](./context-menu-screenshot.png)

## Shortcut Keys

You can set the menu item's `ShortcutKeys` value, but be aware, it must be a _valid_ shortcut key, which typically means that there is a modifier included. As an example:

```cs
new ToolStripMenuItem
{
Text = "Count Lines...",
Image = Properties.Resources.CountLines,
ShortcutKeys = Keys.C
};
```

Will fail with the exception "System.ComponentModel.InvalidEnumArgumentException: Attribute 'value' (88) of Enum type 'Keys' is not valid". If the `ShortcutKeys` is set to something like `Keys.Alt | Keys.C` then the call will succeed. This _not_ in the .NET documentation as far as I am aware.

The details of the logic to see what is a valid shortcut key or not are at:

https://referencesource.microsoft.com/#System.Windows.Forms/winforms/Managed/System/WinForms/ToolStripManager.cs,54f03ea0326af803,references

## Troubleshooting

**I cannot see the context menu extension, or it does not activate properly, when the user has selected more than 15 items**
Expand Down
17 changes: 0 additions & 17 deletions docs/index.md

This file was deleted.

0 comments on commit 378a1a7

Please sign in to comment.