Re: any easy way of having a YES/NO dialog return a 1 or 0?



On Tue, Jan 17, 2012 at 10:53 AM, Gary Kline <kline thought org> wrote:
On Sun, Jan 15, 2012 at 10:46:21PM +0100, David Ne??as wrote:
Date: Sun, 15 Jan 2012 22:46:21 +0100
From: David Ne??as <yeti physics muni cz>
Subject: Re: any easy way of having a YES/NO dialog return a 1 or 0?
To: Gary Kline <kline thought org>
Cc: GTK Devel List <gtk-app-devel-list gnome org>

On Sun, Jan 15, 2012 at 01:26:53PM -0800, Gary Kline wrote:
is there a way of having a YES/NO dialog [that asks a qauestion]
return a truth value? i'm looking for something like the macro
eprint(...) that James Steward sent in late december.

Use gtk_message_dialog_new() with GTK_BUTTONS_YES_NO buttons type.
Your boolean is then equal to

    gtk_dialog_run(dialog) == GTK_RESPONSE_YES

(which also runs the dialog but you can, of course, separate the
execution and comparison).

if i eventually figured out a similar marcro that included:

    GTK_STOCK_YES,1,
    GTK_STOCK_NO, 0...

I don't understand what stock item names have to do with this.

Yeti

       this is why i asked the question!

       thank you,

Just because, curiously nobody seems to have said this already
in this thread,

You do realize that there is a good reason why we try to discourage
people from creating "YES/NO" dialogs right ?

Even in english, these boolean YES/NO questions can seem ambiguous,
to the user, as specially if you start off with a macro in your code and
try to form all of your questions in a way that will have a yes or no answer.

But the moment you localize your application then this becomes a more
serious problem, translators can easily shift the words of your dialog
around to sound more natural in another language, in which case
the YES/NO answer can be even more ambiguous.

For instance:
  "Are you sure you want to quit without saving"
Might come out in another language like:
  "Don't you want to save before you quit ?"

To make things more problematic, some languages don't have
words for "YES" and "NO", or they don't make sense in most
english contexts.

Also, in a language like Korean or Japanese, it's very confusing
because very often, the opposite word than the one in english
would be used.

For instance, if I ask "it's not easy is it", in english one would
reply "NO, its not", in Korean one would reply "YES, it's not".

In any case, to avoid this ambiguity, what we do is try
to always use meaningful answers to the questions
we pose in dialogs.

   "Are you sure you want to quit without saving ?"

Should typically have the answers: "Save" "Quit"

Cheers,
          -Tristan



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]