[HELP] Facing a datagrid bug

Andre Garzia andre at andregarzia.com
Tue Aug 16 12:14:21 EDT 2011


On Tue, Aug 16, 2011 at 1:09 PM, Andre Garzia <andre at andregarzia.com> wrote:

>
>
> On Tue, Aug 16, 2011 at 12:58 PM, Andre Garzia <andre at andregarzia.com>wrote:
>
>> the error is not on sorting, it is on:
>>
>> _table.DrawColumns
>>
>> some error in an object reference... odd... only when ascending, the
>> descending sort works.
>>
>
>
> I think I found it. When sorting ascending, the pIndexesToDraw variable
> which contains a comma separated list of indexes, has an extra comma like:
>
>  ,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18
>
> So it fails. I think I might have uncovered a bug somewhere
>


I've added the following code to the data grid library:

## Default is not to pass in value for pIndexes to draw in which case
      ## we use the base sequence for visible controls to determine indexes
to draw
      if pIndexesToDraw is not empty then
         put itemOffset(item 1 of pIndexesToDraw, sIndexSequencing) - 1 into
theSequence
      else
         put item sTableObjectsA["base sequence for visible controls"] to \
               (sTableObjectsA["base sequence for visible controls"] +
sTableObjectsA["row control count"] - 1) of sIndexSequencing into
pIndexesToDraw
         put sTableObjectsA["base sequence for visible controls"] - 1 into
theSequence
      end if

## AAG: Below I fix a possible bug
      repeat while char 1 of pIndexesToDraw is not a number
         delete char 1 of pIndexesToDraw
         if pIndexesToDraw is empty then
            exit repeat
         end if
      end repeat


With that in place, everything starts working.


>
>
>
> --
> http://www.andregarzia.com All We Do Is Code.
>



-- 
http://www.andregarzia.com All We Do Is Code.



More information about the Use-livecode mailing list