(Jeremy, this will affect your code, and we can use it to fix the bug
that was just pointed out where you can't cancel an action you should
be able to cancel. Right now all you get is yes/no...
This feature isn't available on the Motif side. Unless someone wants
to write it, it's probably not going to be soon. We need to start
thinking about how we want to handle what is now an inevitable
divergence. How were you planning we handle this Linas?)
On the GNOME side, I've obsoleted verifyBox which took one string,
put up a dialog with OK or cancel and returned true or false depending
on the result with a new function "queryBox". On the GNOME side,
verify box is just a wrapper for queryBox right now, but all the code
that calls verifyBox and could benefit from the new function's
features should be migrated. The new prototypes are:
int
queryBox(const char *text,
int default_answer,
gncBoolean yes_allowed,
gncBoolean ok_allowed,
gncBoolean no_allowed,
gncBoolean cancel_allowed);
on the C side, where each of the allowed_* flags says whether or not
you want that button to show up in the dialog and the default_answer
indicates which button should be the default where 1 is OK or Yes, 0
is no, and -1 is cancel. These are the same values returned by the
function to indicate which button was pressed.
On the guile side we have:
(define (gnc:query-dialog message
default-answer
yes-button?
ok-button?
no-button?
cancel-button?) ...)
where the semantics are slightly different. Here default-answer is a
symbol, either 'ok, 'yes, 'no, or 'cancel, and the return value is #t
for yes/OK, #f for no, and 'cancel for cancel. Code calling it might
look like this (this is the current test case I've stuck on the
extensions menu...):
(gnc:extensions-menu-add-item
"Test query dialog"
"Test query dialog hint"
(lambda ()
(let ((result (gnc:query-dialog
"Would you like to play a game?"
'yes
#t #f #t #t)))
(case result
((#t) (gnc:error-message-dialog "You said yes."))
((#f) (gnc:error-message-dialog "You said no."))
((cancel) (gnc:error-message-dialog "You said cancel."))))))
Note that I just defined gnc:message-dialog like this:
(define (gnc:message-dialog message)
(let ((result (gnc:query-dialog message 'ok #f #t #f #f)))
#t))
--
Rob Browning <[EMAIL PROTECTED]> PGP=E80E0D04F521A094 532B97F5D64E3930
----- %< -------------------------------------------- >% ------
The GnuCash / X-Accountant Mailing List
To unsubscribe, send mail to [EMAIL PROTECTED] and
put "unsubscribe gnucash-devel [EMAIL PROTECTED]" in the body