properties vs local variable

Terence Heaford t.heaford at btinternet.com
Mon Mar 10 08:15:58 EDT 2014


Mark,

Thanks for your comments.

I am not having a particular problem, just trying to write efficient methods.

I have created my own text table in a group consisting of 6 cols (fields) * 20 rows (fields) to try and speed up the scrolling when using a DG.

This has worked with a scrolling speed increase of approx. 30% when compared to the DG, probably because my table purely uses text and has no need for the remaining code that is in the DG.

The most time consuming element is loading all the fields with the data. Here is the displayData routine.

Can you see any areas that could me modified to speed it up?

on displayData tRecNum
   --put milliseconds() into tS
   lock screen
   lock messages
   set the uRecNum of me to tRecNum
   put the uCols of me into tCols
   put the uRows of me into tRows
   set the itemDelimiter to tab
   put 1 into tFldNum
   put 1 into tLineNum
   put line tRecNum to tRecNum + tRows - 1 of the uData of me into tData
   put line tRecNum to tRecNum + tRows - 1 of the uSelected of me into tSelectedData
   repeat for each line tRecData in tData
      put item 1 to tCols of tRecData into tFldData
      if line tLineNum of tSelectedData = true then
         put "62,117,215"  into tBackColor
         put "255,255,255"  into tForeColor
      else
         put "0,0,0"  into tForeColor
         if tLineNum mod 2 = 0 then
            put "244,246,250" into tBackColor
         else
            put "255,255,255" into tBackColor
         end if
      end if
      repeat for each item tCellData in tFldData
         put tCellData into fld tFldNum of me
         set the backgroundColor of fld tFldNum of me to tBackColor
         set the foregroundColor of fld tFldNum of me to tForeColor
         add 1 to tFldNum
      end repeat
      add 1 to tLineNum
   end repeat
   unlock messages
   unlock screen
      --put milliseconds() - ts into cd fld "result"
end displayData



All the best

Terry

On 10 Mar 2014, at 10:46, Mark Schonewille <m.schonewille at economy-x-talk.com> wrote:

>  If you explain what you're trying to do, perhaps we can find a better way to do it.
> 




More information about the use-livecode mailing list