Hi Bram,
I did some testing and came up with a workaround. Most of this is because you set the button to be “text only” so, internally, it only renders the text object (sorry I didn’t notice this initially).
To make different labels align left, you can use the following workaround instead of setting the anchorX to 0. Just add half the button’s width to an x “edge” position (whatever you need). You’ll need to do this both when the button is created and when the label changes.
[lua]
addScreen.categoryBtn = widget.newButton(
{
label = “Friend”,
labelColor = {default={129/255, 202/255, 195/255}, over={1,1,1}},
font = font.robotoM,
fontSize = 15,
onEvent = functions.openCategory,
emboss = false,
textOnly = true,
x = 0,
y = centerCor.addMainRectY * 1.15,
}
)
addScreen.categoryBtn.x = addScreen.categoryBtn.width/2 + centerCor.addMainRectX * 1.375
function functions.categoryItemEvent(event)
if event.phase == “ended” then
categorySelector = event.target.id
addScreen.categoryBtn:setLabel(categorySelector:gsub("^%l", string.upper))
addScreen.categoryBtn.x = addScreen.categoryBtn.width/2 + centerCor.addMainRectX * 1.375
print("categorySelector = " … categorySelector)
end
end
[/lua]
Hope this helps!
Brent