Loading ...
Sorry, an error occurred while loading the content.

Re: E331: Must not add menu items directly to menu bar

Expand Messages
  • Bram Moolenaar
    ... Well, I thought it was obvious. And when someone didn t get it, he will get an error message. ... I m sure there is a menu without-a-name now! You can
    Message 1 of 8 , Jul 4, 2001
    • 0 Attachment
      Benji Fisher wrote:

      > This could be interpreted as requiring a path before the menu item, but I
      > think (especially since :help E331 leads to this section in the Vim 6.0 help
      > files) it should be more explicit. How about adding "(nonempty) " before
      > "path"?

      Well, I thought it was obvious. And when someone didn't get it, he will get
      an error message.

      > I tried using an empty path:
      >
      > :menu .Foo :echo "foo"<CR>
      >
      > This generated neither an error, a warning, nor a menu item. Shouldn't it
      > do at least one? ;)

      I'm sure there is a menu without-a-name now! You can use it by moving the
      mouse pointer to the character between "". :-)
      I'll make this an error.

      Actually ":emenu .Foo" works.

      --
      hundred-and-one symptoms of being an internet addict:
      96. On Super Bowl Sunday, you followed the score by going to the
      Yahoo main page instead of turning on the TV.

      /// Bram Moolenaar -- Bram@... -- http://www.moolenaar.net \\\
      ((( Creator of Vim -- http://vim.sf.net -- ftp://ftp.vim.org/pub/vim )))
      \\\ Help me helping AIDS orphans in Uganda - http://iccf-holland.org ///
    • Benji Fisher
      ... [snip] ... So it does. Also, when I looked closer, I realized that there was extra space before the Help menu. Clicking there, I get two options:
      Message 2 of 8 , Jul 4, 2001
      • 0 Attachment
        Bram Moolenaar wrote:
        >
        > Benji Fisher wrote:
        >
        [snip]
        > > I tried using an empty path:
        > >
        > > :menu .Foo :echo "foo"<CR>
        > >
        > > This generated neither an error, a warning, nor a menu item. Shouldn't it
        > > do at least one? ;)
        >
        > I'm sure there is a menu without-a-name now! You can use it by moving the
        > mouse pointer to the character between "". :-)
        > I'll make this an error.
        >
        > Actually ":emenu .Foo" works.

        So it does. Also, when I looked closer, I realized that there was extra
        space before the "Help" menu. Clicking there, I get two options: "Tear off
        this menu," which generates an error, and "Foo", which works as expected.
        That's in Vim 5.7: in 6.0aj, the first opens up the Toolbar menu.

        Well, I guess it does not matter much if this is going to be an error in
        the next version.

        --Benji Fisher
      • Dany St-Amant
        ... Also on some OS like MacOS there s no easy way of getting an empty menu to act like a button. But an empty menu doesn t hurt anything generally. So ...
        Message 3 of 8 , Jul 4, 2001
        • 0 Attachment
          Le Mercredi 4 juillet 2001, à 01:36, Bram Moolenaar a écrit :

          >
          > Benji Fisher wrote:
          >
          >> Bohdan Vlasyuk wrote:
          >>>
          >>> Why does it hapepn ? What can't I add new menu directly to menu bar??
          >>
          >> Do you mean like
          >>
          >> :menu Foo :echo "foo"<CR>
          >>
          >> That is pretty unusual, but I suppose you have your reasons. It seems
          >> that a
          >> menu item needs to be inside a menu, so
          >>
          >> :menu Foo.f :echo "foo"<CR>
          >>
          >> works. Sorry, I do not know why. If this restriction is needed, I
          >> think the
          >> docs should be more explicit about it.
          >
          > I thought it's pretty obvious. If you would add an item directly to
          > the menu
          > bar it would be a button, not a menu. This is bad UI design (ever used
          > OS/2?
          > The shell item in the top bar brings down a menu with choices, the
          > "shutdown"
          > item immediately does a shutdown. Very confusing!).

          Also on some OS like MacOS there's no easy way of getting an empty menu
          to act like a button. But an empty menu doesn't hurt anything generally.
          So
          Vim should probably accept:

          :menu FIle
          " Above there's nothing after the FIle
          :menu File.Edit :e<CR>

          As it's logical to create the menu first, then add the item to it.

          The help (or error message) could mention something like:

          "Only menu item can have action associated to them."

          Dany
        • Bohdan Vlasyuk
          ... Personally for me natural way seem to be create empty menu first, and then add subentries -- A Riverside, California, health ordinance states that two
          Message 4 of 8 , Jul 5, 2001
          • 0 Attachment
            On Wed, Jul 04, 2001 at 08:59:53PM +0200, Bram Moolenaar wrote:

            >> This could be interpreted as requiring a path before the menu item,
            >> but I think (especially since :help E331 leads to this section in
            >> the Vim 6.0 help files) it should be more explicit. How about
            >> adding "(nonempty) " before "path"?
            > Well, I thought it was obvious. And when someone didn't get it, he
            > will get an error message.
            Personally for me natural way seem to be "create empty menu first, and
            then add subentries"


            --
            A Riverside, California, health ordinance states that two persons may
            not kiss each other without first wiping their lips with carbolized rosewater.
          Your message has been successfully submitted and would be delivered to recipients shortly.