How to delete a separator line from a menu?

It seems that Keith Berard has found a documentation glitch... Last Updated: 2006-10-16

=Question=

How can I delete a specific seperator bar in a menu?

=Steve Cuzner answers=

The only way to address a separator bar is to use the ordinal position of it as a menu item. For example, the first separator on the File menu is the fifth item so you can use "menu_delete .File.#5".

=Keith Berard adds=

Hmm... you know, my code is actually removing separators by name. For example:

mad -before :EditPopup.#1 CITSEP -separator

then later in the code:

mdel :EditPopup.CITSEP

I do some additional checks before the delete such as "menu_exists(': EditPopup.CITSEP')", but otherwise that's it.

=Steve Cuzner replies=

Wow, this works. But I would be careful with it because the documentations states: "-separator specifies that this menu item is a separator line. In this case label should be a null string and no additional options are allowed."

So technically CITSEP should be a null string and if the documentation is silent on the subject or contradicts actual behavior, as in this case, the behavior is not guaranteed and could change at any time. I recommend that you submit this as document change request so that this nice behavior can be documented and saved. It would be much easier to name separators rather than use the ordinal label.

The other thing to consider is whether the default menu separators have labels, as in my .File.#5 example, of if they are unnamed and must use the ordinal.