Scheme question re: complex report options

Derek Atkins warlord at MIT.EDU
Fri Dec 28 07:59:58 EST 2007


Quoting Charles Day <cedayiv at gmail.com>:

> I am trying to set up a new boolean report option (a "Notes" checkbox), but
> I only want it to be available when one of the other existing boolean
> options ("Memo") is already checked (i.e. the "Notes" checkbox should be
> enabled only when "Memo" is checked). Using the make-complex-boolean-option
> procedure, I was able to get this behavior working, except for one small
> problem. If the user clicks the Apply button, the "Notes" checkbox is no
> longer affected by clicking "Memo". The two checkboxes have become
> completely independent.

This sounds like a bug in the options dialog.

> You can see a similar result in GnuCash 2.2.2.  Run a Transaction Report,
> then click Options. On the General tab, check the Common Currency option.
> The Report Currency option (a drop-down) becomes enabled. Click Apply. Now
> no amount of clicking or unclicking the Common Currency checkbox will get
> the Report Currency drop-down disabled again. It only works properly before
> you press Apply.

Please file a bug report on this.  It's a bug in the C code.

> Am I doing something wrong? Does anyone know how to fix this?  Here is the
> Scheme code that sets up the dependency between checkboxes:

No, I don't think you're doing anything wrong.  As for how to fix it,
use "OK" instead of "Apply" ;)  I bet what's going on is that the Apply
probably does a recursive "set_sensitive" or something....

> (gnc:register-trep-option
>   (gnc:make-complex-boolean-option
>    gnc:pagename-display (N_ "Memo")
>    "d"  (N_ "Display the memo?") #t
>    #f
>    (lambda (x) (gnc-option-db-set-option-selectable-by-name
>         gnc:*transaction-report-options*
>         gnc:pagename-display
>         (N_ "Notes")
>         x))))

This scheme code looks correct.

-derek

-- 
       Derek Atkins, SB '93 MIT EE, SM '95 MIT Media Laboratory
       Member, MIT Student Information Processing Board  (SIPB)
       URL: http://web.mit.edu/warlord/    PP-ASEL-IA     N1NWH
       warlord at MIT.EDU                        PGP key available



More information about the gnucash-devel mailing list