Bug: Can not create Context Menu Separator

  • Thread starter Thread starter Pawel Achtel
  • Start date Start date
Hmm - If this is a top level menu item then it can't be turned into a
seperator - try it in Visual Studio
 
I had a look at this a bit further and it does not crash - it does however
throw an exception (NotSuportedException) when you try to convert a menu
item into a seperator and vice versa. It also only does this when the
MenuItem involved is already added to a MainMenu that has been attached to a
form.


Which I don't think is wholly unreasonable and I suspect the phrase used
will be 'as designed'.
 
Hi Shaun ,

Saying "Crashes" is the exception. Plus, it is unreasonable, because I tried
to make a separator in a Context Menu, not in a Main Menu. It is a bug in my
view.

Pawel
www.24x7.com.au
 
Same think happened in my code when I tried to add a separator to a context
menu, so I am not using them for now.
 
Hi Pawel

Can you show your actual code ?

Shaun

Pawel Achtel said:
Hi Shaun ,

Saying "Crashes" is the exception. Plus, it is unreasonable, because I tried
to make a separator in a Context Menu, not in a Main Menu. It is a bug in my
view.

Pawel
www.24x7.com.au


to
 
It is VC 2003 generated code

1. Create a form
2. Create context menu with a few menu items
3. Add separator to the menu (using Add separator function of VS)
4. Studio generates code that essentially puts "-" as a text of the
separator menu item

This does not work (throws exception) in what is essentially VS generated
code

Pawel
www.24x7.com.au
 
Pawel,

Does this happend on Windows CE platform only or both Pocket PC and Windows
CE platform? There is a know bug where setting a contextmenu item to
separator after it's added to the ContextMenu controls would throw a
NotSupportedException. The problem here is that WinCE has a restriction
that does not allow marking (changing) a menu item as a separator after the
item was added to a contextmenu and the contextmenu was parented by a
control. In VS 2003 the way designer spits the code for device project is
similar to desktop which causes this problem. The work around would be to
add the contextmenu in separate method outside InitilizeComponent.

Hope this helps,

David


This posting is provided "AS IS" with no warranties, and confers no rights.
 
Back
Top