jf-roku/components/JFButton.bs

25 lines
656 B
Plaintext
Raw Normal View History

2021-07-09 10:21:24 +00:00
sub init()
2021-07-09 20:08:32 +00:00
m.top.observeFieldScoped("text", "onTextChanged")
m.top.iconUri = ""
m.top.focusedIconUri = ""
m.top.showFocusFootprint = true
m.top.minWidth = 0
2021-07-09 10:21:24 +00:00
end sub
'
' Whenever the text changes, pad both sides with whitespace so we can center the button text
'
2021-07-09 10:21:24 +00:00
sub onTextChanged()
2021-07-09 20:08:32 +00:00
addSpaceAfter = true
minChars = m.top.minChars
if minChars = invalid then minChars = 50
while m.top.text.Len() < minChars
if addSpaceAfter
m.top.text = m.top.text + Chr(160)
else
m.top.text = Chr(160) + m.top.text
end if
addSpaceAfter = addSpaceAfter = false
end while
2021-07-09 10:21:24 +00:00
end sub