octave-patch-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-patch-tracker] [patch #9084] uitable implementation


From: Noname
Subject: [Octave-patch-tracker] [patch #9084] uitable implementation
Date: Sun, 31 Dec 2017 14:27:20 -0500 (EST)
User-agent: Mozilla/5.0 (X11; Fedora; Linux x86_64; rv:57.0) Gecko/20100101 Firefox/57.0

Follow-up Comment #31, patch #9084 (project octave):

execute the command

 uitable('ColumnEditable',true,'Data',[11 21; 12 22; 13
23],'CellEditCallback',@(h)disp(get(h,'Data'))); 

and modify cells in the second column. the output is scrambled. an entry at
the position x=1;y=0 (where 21 is stored) overwrites the entry at position
x=0;y=2 (where 13 is stored).

the reason is that at several places octave_idx_type is calculated
incorrectly. as example at table.cc Table::itemChanged() we have 


if (data.iscell ()){...}
else{
  data.fast_elem_insert (row + col * data.columns (), new_value);
  ...


but it should be


data.fast_elem_insert (row + col * data.rows (), new_value);


data.rows() gives the total number of rows of the table; row and col the
actual position where we are. if we are in column n the index must be the
actual column n * total number of rows of the table (because we have to count
n rows and not columns). hence i have changed all row + col * xyz.columns ()
statements into row + col * xyz.rows ().

the second "help uitable" example is working much better now but x,y
coordinates are still scrambled. however what ever is the reason the output is
now identical to what matlab gives if i run the same code.

last year 2017 patch

(file #42774)
    _______________________________________________________

Additional Item Attachment:

File name: patch_9084_uitable-20171231_v2.diff Size:102 KB


    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/patch/?9084>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]