Hi,

In my work on the Entry Ledger, I've come across a problem.  I'm
trying to write some code to determine _which_ cells changed.  In
particular, I want to find out if a particular cell is the only cell
that changed within a particular cursor.  Is there an easy way to do
that?

I know that I could do this by running a loop over all my cells, by
name, and testing whether the cell changed by calling:

        gnc_table_layout_get_cell_changed (ledger->table->layout, cell_name,
                                          TRUE))

However, that seems like a lot more work, IMHO.  The cursor clearly
knows whether there were any changes[0].

Question: since the cells are actually numbered in the Cursor[1],
can't we provide a bitmask for all the cells that changed, and provide
a function that gives the bit position of a cell in a cursor based on
it's name?  Then I could see if the bitmask is all negative in all
positions other than the one in question.

Another solution to my particular problem would be a function to
return the number (count) of changed cells.  If the count != 1 then I
know that something else was changed other than the cell in question.

Any suggestions?

-derek

[0] You can tell if a cursor changed by calling:
  gnc_table_current_cursor_changed (ledger->table, FALSE)

[1] When you add a cell to a cursor you give it a position in the cursor:
  gnc_table_layout_set_cell (layout, curs, ENTRY_TAXACC_CELL, 0, x++);
One would think that you could remember what 'x' was in this particular
case and map ENTRY_TAXACC_CELL to the value of 'x'.  That way it would
be easy to return a bitmask of changed cells, because a change in cell
ENTRY_TAXACC_CELL would map to a bit in position 0,x in the bitmask.

-- 
       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
       [EMAIL PROTECTED]                        PGP key available
_______________________________________________
gnucash-devel mailing list
[EMAIL PROTECTED]
http://www.gnumatic.com/cgi-bin/mailman/listinfo/gnucash-devel

Reply via email to