NSParagraphStyle

Using

set aParStyle to (someAttrStrRange's valueForKeyPath:"NSParagraphStyle")
if aParStyle is not equal to missing value then
set aAlign to (aParStyle's valueForKeyPath:"alignment")
end

will return a integer between 0 and 5 which was the index for a list.
Formerly the list was {left, right, center, justified, natural} then it changed to {left, center , right, justified, natural}

Currently there is the problem that the above code depending on machine (not OS!) returns different numbers for a centered text - so it can be 2 or 1

Any ideas why

It’s the result of a different definition used in iOS. The solution is to use the constants, not numbers, so they are resolved at runtime.

Many thanks for the reply Shane,

But I fear I don’t understand. :confused:
What do you mean by “using the constants”?
My goal is to figure out whether the text attribute of a given text is “center”, “left” etc.

Andreas

Using your code above:

if aAlign = current application's NSTextAlignmentRight then
...

You resolve NSTextAlignmentRight at run-time, rather than trying to guess if it’s 1 or 2.

Aah,

Now I got what you mean. Shame on me it took so long.

Thanks
Andreas