[cells-gtk-devel] Modal Dialogs

Peter Denno peter.denno at nist.gov
Mon Jul 17 19:16:57 UTC 2006


Hi Shuan,

How about something like this (from test-gtk/test-dialogs.lisp):

 (mk-button :label "Query for text"
                           :on-clicked 
                           (callback (w e d) 
                             (let ((dialog
                                     (to-be
                                      (mk-message-dialog
                                       :md-name :rule-name-dialog
                                       :message "Type something:"
                                       :title "My Title"
                                       :message-type :question
                                       :buttons-type :ok-cancel
                                       :content-area (mk-entry :auto-aupdate 
t)))))
                               (setf (text (fm^ :message-response))
(md-value dialog))))))

The callback on the button creates a dialog, to-be pops it up (I think) and it 
hangs around until you OK, at which point it grabs the value out of it an (in 
this case) displays it in a textview. 



On Monday 17 July 2006 13:20, Shaun Kruger wrote:
> I am trying to figure out how to show a modal dialog and return a
> value.  In this case the modal dialog is a login prompt.
>
> I have this:
>
> (defmodel login-prompt (window)
>   ()
>   (:default-initargs
>
>     :title "Login"
>     :md-name :loginprompt
>     :kids
>
>     (list (mk-vbox :kids (list
>       (mk-entry :md-name :username)
>       ...other widgets...
>       (mk-button :text "OK"
>
>           :on-clicked
>
>           (callback (widget event data)
>               ...login processing...
>               ...set return value/return from form...
> )))))))
>
> I have login processing done for the moment (still a little bit about
> exception handling I need to mess with).  I just don't know how to
> call the login prompt into existence and block execution until it
> returns.
>
> I know this shouldn't be as hard as it looks, but I am at a little bit
> of a disadvantage.  I'm still learning cells, I havn't done much GTK,
> and I'm recovering from doing a couple of years of .NET programming.
>
> Any understanding you guys can provide would really help.  Once again,
> I'll document whatever I can understand.
>
> Shaun

-- 
- Best regards,
   Peter



More information about the cells-gtk-devel mailing list