On Tue, 6 Sep 2005 10:00:24 +0200 (Romance Daylight Time)
Michael Van Canneyt <[EMAIL PROTECTED]> wrote:

> 
> 
> On Mon, 5 Sep 2005, Mattias Gaertner wrote:
> 
> > On Mon, 5 Sep 2005 17:04:04 +0200 (Romance Daylight Time)
> > Michael Van Canneyt <[EMAIL PROTECTED]> wrote:
> >
> >>
> >>
> >> On Mon, 5 Sep 2005, Alexsander Rosa wrote:
> >>
> >>> After years of development with this kind of dialog box (with a
> >>> caption, a message ending with a question and buttons labeled Yes, No,
> >>> Cancel etc), I've noticed than most non-tech users actually do not
> >>> READ the message, they just read the labels of the buttons and click
> >>> Yes or No (rarely Cancel), almost automatically - no thinking at all.
> >>>
> >>> I did some GUI and usability research and found that many experts
> >>> suggest that the labels of the buttons should state the action that
> >>> will be performed. IIRC, Open Office dot Org does that: when you try
> >>> to exit when the text has changed, instead of the classic "Save
> >>> changes?" (Yes, No, Cancel) it says something like: "There are
> >>> changes." (Save, Discard, Cancel). The experience shows that users
> >>> read the buttons, not the message.
> >>>
> >>> Of course it's simple to write such a dialog box, but it would be nice
> >>> to have it as a built-in feature, to educate new developers and create
> >>> a standard. This would also solve this language problem, as most text
> >>> would be provided - except, maybe, "Cancel", that could be defined
> >>> globally somewhere or at least have a default text.
> >>
> >> I think this can be easily implemented as an overloaded form of
> >> MessageDLG, where instead of [mbOK,mbCancel] you pass the captions of
> >> the buttons.
> >
> > Sounds like
> > QuestionDlg
> 
> Fine too :)
> 
> >
> >
> >> MessageDLg('File has changed. Save
> >Changes?',MB_WARNING,['&Save','&Don''t > save','&Cancel'],0)
> >>
> >> The first button is the default button, and the function returns the
> >index > of the pushed button, or -1 if the dialog was closed by closing
> >the > window.
> >
> > Example:
> > QuestionDlg('File has changed. Save
> > Changes?',mtError,[mrYes,mrCancel,'Cancel
> > now',mrIgnore,300,'Sophisticated Save'],0);
> 
> I would only allow strings. But maybe I miss the point of your proposal ?

Maybe the example was a little bit overkill.
For most choices the standard captions ('Yes', 'No', 'Cancel', ...) and
there constants (mrYes, mrNo, mrCancel, ...) are sufficient. But often you
need more specific text on a button and sometimes a new constant. That is
what QuestionDlg is good for.  

Example:
QuestionDlg('File has changed','Save Changes?',
  mtConfirmation,[mrYes,mrCancel,'Cancel now',
           mrIgnore,300,'Sophisticated Save'],0);

This translates to the following buttons:
mrYes with 'Yes'
mrCancel with 'Cancel now'
mrIgnore with 'Ignore'
300 with 'Sophisticated Save'

QuestionDlg uses the same 'Return' and 'Escape' button precedence like
MessageDlg.
And you can use it the same way:

if QuestionDlg(...)=mrOk then ...


Mattias

_________________________________________________________________
     To unsubscribe: mail [EMAIL PROTECTED] with
                "unsubscribe" as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives

Reply via email to