Re: a Close button too many

Chisheng Huang <[email protected]> Tue, 10 Jul 2007 14:58:40 -0700
Newsgroups gmane.lisp.clg.devel
Message-ID <[email protected]>
"Walter C. Pelissero" <[email protected]> writes:

> Sorry if this is not a CLG specific question; it may just be that I'm
> not understanding GTK itself.
>
> I'm trying to write a yes/no dialog with this code:
>
> (let* ((response nil)
>        (dialog (make-instance 'message-dialog
> 			:message-type :question
> 			:button '("gtk-yes" :yes)
> 			:button '("gtk-no" :no)
> 			:text message
> 			:signal (list 'response #'(lambda (dialog id)
> 						    (setf response (dialog-find-response dialog id)))
> 			:object t))))
>     (dialog-run dialog)
>     (widget-destroy dialog)
>     (eq response :yes))
>
>
> But contrary to my expectations I don't get two buttons but three.
> How do I get rid of the Close button?

If you really want to get rid of the close button, insert the following
right above (DIALOG-RUN DIALOG) :

  (let ((hbox (dialog-action-area dialog)))
    (container-remove hbox
                      (find "gtk-close" 
                            (container-children hbox)
                            :key #'button-label :test #'string=)))

Or you can just implement a yes-or-no dialog based on the vanilla 
gtk:dialog directly.

Best wishes,

-cph

-------------------------------------------------------------------------
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/