Task: Add ellipses if text does not fit visible field width. V4, v5 and v6 I put the data into the field and then looped thru the lines. If text was too wide I chopped off 1/2 of the overflow chars(rough guess) and then iterated what was left using the formattedwidth as the last chars were deleted with the added ellipses to see if it's all visible.
Simple enough but as 7, 8, 9 were released this became very slow. On Android device using v9 a list 200-300 hundred lines long(only 25 visible) took about 6 seconds to render with the screen locked. I never timed it but it seemed like the time increased exponentially as the list grew. Refactor: 1) Insert the field text/styles using a pre-loaded styledText array 2) Calculating the ellipses in that array using the measureText function. Now the same list took about 1.5 seconds. That's about 4 times faster and the seems that the time is more linier as the list grows. That begs 2 questions for me(at least) 1) A charAtPixel function in the engine would make the adding ellipses much faster. 2) When operating on a field that was hidden, screen locked or you just don't care if you see delayed changes.... Have the field object only operate on an internal styledText array and only start the "go down the hall, into a room, open the closet... as Richard's prose said" when you want to render the field on the screen. Now there may be times for reasons I can't think of right now that the internal styledText array might need to be flushed to the field before the field is visible or the screen is unlocked. Ralph DiMola IT Director Evergreen Information Services rdim...@evergreeninfo.net _______________________________________________ use-livecode mailing list email@example.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode