components_ui_button_JRButtonGroup.bs
function onKeyEvent(key as string, press as boolean) as boolean
if not press then return false
currentFocus = m.top.buttonFocused
currentFocusButton = m.top.getChild(currentFocus)
if key = "right"
' Move right, skipping disabled buttons
for i = currentFocus + 1 to m.top.getChildCount() - 1
button = m.top.getChild(i)
print "button =", button
if button.enabled
currentFocusButton.focus = false
m.top.buttonFocused = i
button.focus = true
return true
end if
end for
' wrap if needed
for i = 0 to currentFocus - 1
button = m.top.getChild(i)
print "button =", button
if button.enabled
currentFocusButton.focus = false
m.top.buttonFocused = i
button.focus = true
return true
end if
end for
else if key = "left"
' Move left, skipping disabled buttons
for i = currentFocus - 1 to 0 step -1
button = m.top.getChild(i)
print "button =", button
if button.enabled
currentFocusButton.focus = false
m.top.buttonFocused = i
button.focus = true
return true
end if
end for
' wrap if needed
for i = m.top.getChildCount() - 1 to currentFocus + 1 step -1
button = m.top.getChild(i)
print "button =", button
if button.enabled
currentFocusButton.focus = false
m.top.buttonFocused = i
button.focus = true
return true
end if
end for
end if
return false
end function