Re: a Close button too many

Espen S Johnsen <[email protected]> 12 Jul 2007 11:03:25 +0200
Newsgroups gmane.lisp.clg.devel
Message-ID <[email protected]>
[email protected] (Walter C. Pelissero) writes:

> I thought the Close button was something I could turn off with an
> argument.  I used your example, instead.

Hello

The reason for this Close button appearing was a minor design flaw on my
side. If you do a CVS update, your code should now work as expected. 

The :buttons initarg can also be used with the message-dialog class to
specify button configuration as a keyword (:yes-no in your case). Using
this method will make your code a bit cleaner.

I've also fixed another flaw, which was the passing of numeric response
id to response signal handlers. This change may break some existing
code, but my original intention was to not expose these numeric ids in
the user level API.

Your code example would then look like this:

  (let* ((response nil)
         (dialog (make-instance 'message-dialog
                  :message-type :question
                  :buttons :yes-no ;; the default for for message type 
                                   ;; :question and can actually be left out
                  :text message
                  :signal (list 'response 
                           #'(lambda (id)
                              (setf response id))))))
      (dialog-run dialog)
      (widget-destroy dialog)
      (eq response :yes))

It is also possible to specify response ids as signal names for dialogs:

  (make-instance 'message-dialog
   :message-type :question
   :signal (list :yes
            #'(lambda ()
                (do-something-when-user-clicks-yes)))         
   :signal (list :no
            #'(lambda ()
                (do-something-when-user-clicks-no))))

A callback function may also be given as part of a button specification
with the :button initarg or dialog-add-button function:

  (make-instance 'dialog
   :button (list "button-text-or-stock-button-name"
            #'(lambda ()
                (do-something-when-user-clicks-button))))

-- 
Espen

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/