SDK static_text alignment and truncation don't work properly

  • 1
  • Problem
  • Updated 7 years ago
The "alignment" and "truncation" properties for "static_text" don't work properly:

- With "alignment = 'right'", if the text doesn't have any spaces, then it is properly truncated on the left, with the rightmost character showing on the right. But if the text does have spaces, then the alignment and truncation is screwy: The text is truncated so that the leftmost "word" is showing, and the rightmost character of the text does not show. The value of the "wrap" property doesn't affect this.

- The "truncation" property only truncates on the right, regardless of whether its value is 'head', 'middle', or 'tail'.

Tested system: LR 3.2, Windows 7.

On Mac OS 10.6.4:

- An "alignment" value of "right" never truncates on the left. If the text is too big to fit, the leftmost character is always displayed, regardless of whether it contains spaces.

- Truncation works properly.

Here's a test program:

local LrBinding = import 'LrBinding'
local LrDialogs = import 'LrDialogs'
local LrFunctionContext = import 'LrFunctionContext'
local LrView = import 'LrView'

local bind = LrView.bind
local f = LrView.osFactory()
local share = LrView.share

LrFunctionContext.callWithContext ("", function (context)
local prop = LrBinding.makePropertyTable (context)
prop.text = "abc def ghi jkl mno pqr"
LrDialogs.presentModalDialog {title = "Test", resizable = "horizontally",
contents = f:column {fill_horizontal = 1, bind_to_object = prop,
f:edit_field {value = bind ("text"), immediate = true},
f:row {
f:static_text {title = "alignment = 'right':",
width = share ("l"), alignment = "right",
font = ""},
f:static_text {title = bind ("text"), width_in_chars = 8,
alignment = "right", wrap = false}},
f:row {
f:static_text {title = "alignment = 'left':",
width = share ("l"), alignment = "right",
font = ""},
f:static_text {title = bind ("text"), width_in_chars = 8,
alignment = "left"}},
f:row {
f:static_text {title = "truncation = 'head':",
width = share ("l"), alignment = "right",
font = ""},
f:static_text {title = bind ("text"), width_in_chars = 8,
truncation = "head"}},
f:row {
f:static_text {title = "truncation = 'tail':",
width = share ("l"), alignment = "right",
font = ""},
f:static_text {title = bind ("text"), width_in_chars = 8,
truncation = "tail"}}}}
end)
Photo of John R. Ellis

John R. Ellis, Champion

  • 3869 Posts
  • 1023 Reply Likes

Posted 7 years ago

  • 1
Photo of John R. Ellis

John R. Ellis, Champion

  • 3869 Posts
  • 1023 Reply Likes
This problem still exists in LR 4 beta.