Looks like we've discovered an inconsistency.

Apparently the engine will treat items in the tabstops as column widths if one or more of them is smaller than a preceding item, but if each of the items is larger than the last then the value you get back will be the same you set it to.

If you wrote code expecting the engine to treat incoming values consistently, you risk having unexpected column widths.

So we have to ask ourselves: now that the engine explicitly supports relative values via the tabWidths property, is the "sometimes" rule for setting tabStops a feature or a bug?

--
 Richard Gaskin
 Fourth World
 LiveCode training and consulting: http://www.fourthworld.com
 Webzine for LiveCode developers: http://www.LiveCodeJournal.com
 Follow me on Twitter:  http://twitter.com/FourthWorldSys



On Wed, Aug 14, 2013 at 4:46 PM, Richard Gaskin
<ambassador at fourthworld.com>wrote:

Geoff Canyon wrote:

On Wed, Aug 14, 2013 at 9:34 AM, Richard Gaskin wrote:

The tabstops property requires absolute metrics from the left edge of the
control; that is, each item is the complete measure from that edge, e.g.:

100,150,225


I've never found this to be the case. I just opened up LC 5.0, created a
field with text and tabs in it, and in the message box typed:

  set the tabstops of fld 1 to 200,100,150,75

No crash, and the text formatted the way I expected. Now if I type in the
message box:

  put the tabstops of fld 1

I get:

  200,300,450,525

Which is exactly what I expected; the first value was taken literally, and
the rest were incremental. For kicks, I tried:

  set the tabstops of fld 1 to 200,100,250,675

and then

  put the tabstops of fld 1

gets me:

  200,300,550,675

Which means that the first value was absolute, the next two relative even
though the third was larger than either of the first two (but not larger
than their sum), and the last, which was larger than the sum of the three
previous, was again absolute.


You really expected the value coming back to be different from what you
set it to?

If you set the text of a field to "Hello", do you expect getting the text
from the field to yield "World"? ;)

It seems the engine is being very graceful in allowing both relative and
absolute values as input for the tabStops, but ultimately the values that
get stored are the absolute ones.

If that weren't the case it would mean that Mark Waddingham wasted his
time adding the tabWidth property, and I don't think I've ever seen Mark
willfully waste his time.

Now I'm wondering what the engine does with values in which each column is
larger than the last.  That is, if you set the tabstops to this:

100,150,200

...do you get this back:

100,250,450

..or:

100,150,200

?

--
 Richard Gaskin
 Fourth World
 LiveCode training and consulting: http://www.fourthworld.com
 Webzine for LiveCode developers: http://www.LiveCodeJournal.com
 Follow me on Twitter:  
http://twitter.com/**FourthWorldSys<http://twitter.com/FourthWorldSys>

_______________________________________________
use-livecode mailing list
[email protected]
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Reply via email to