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

73215Re: bug in confirm() and default option

Expand Messages
  • Hari Krishna Dara
    Sep 5, 2006
      On Tue, 5 Sep 2006 at 3:38pm, Bram Moolenaar wrote:

      > Benji Fisher wrote:
      > > On Sun, Sep 03, 2006 at 11:54:11AM -0700, Hari Krishna Dara wrote:
      > > >
      > > > On Sun, 3 Sep 2006 at 8:21pm, Bram Moolenaar wrote:
      > > >
      > > > > I have tried the win32 console version and it works properly there. Do
      > > > > you mean the GUI version? Please be specific, trying all kinds of
      > > > > things to find out what you mean is a waste of time.
      > > >
      > > > I reported that the console version works fine in a separate email, so
      > > > yes, it is the GUI version. Sorry for not being clear.
      > >
      > > In the original post, Hari did say "gvim". On Linux (FC2, GTK-2) I
      > > find that it works as expected in vim (with the GUI not running) but
      > > shows the same problem in gvim (with the GUI running).
      > >
      > > $ vim
      > > :echo confirm("Save changes?", "&Yes\n&No\n&Cancel", 0)
      > > <user types <CR>>
      > > 0
      > > :gui
      > > :echo confirm("Save changes?", "&Yes\n&No\n&Cancel", 0)
      > > <user types <CR>>
      > > 1
      > >
      > > I did it that way to make sure that I was actually using the same binary
      > > with and without the GUI running. The second time I invoked confirm(),
      > > a dialogue box popped up with the "Yes" button highlighted.
      > Many GUIs don't support a dialog without a button selected. Disabling
      > the use of Enter to select a button isn't a good idea either. Thus for
      > some GUIs it simply won't work to have a dialog without a default.

      I know for sure Windows native UI supports dialogs without a default
      button, and Motif also should support this as well. I will in fact be
      surprised if GUIs always force the programmer to specify a default
      button, as there should be a choice not to have one (especially when
      there is a complex interface).

      In my case, I was trying to set no default button when I know there is
      some important information to read, but the user might routinely press
      <Space> or <Enter> to get rid off it. If the dialog doesn't get hidden,
      the user will more likely read it. Right now I resorted to doing an
      echohl with WarningMsg followed by an input(), but this introduces a
      drastic difference from the routine case where the user still sees a


      Do You Yahoo!?
      Tired of spam? Yahoo! Mail has the best spam protection around
    • Show all 15 messages in this topic