Skip to content

Commit 2094da8

Browse files
committed
Update code docs
1 parent 4619970 commit 2094da8

16 files changed

Lines changed: 41 additions & 45 deletions

docs/components_config_LoginScene.bs.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
return true
3838
end if
3939
else if key = "down" and not isValid(m.buttons.focusedChild)
40-
m.buttons.callFunc("focus")
40+
m.buttons.setFocus(true)
4141
return true
4242
else if key = "up" and isValid(m.buttons.focusedChild)
4343
m.checkbox.setFocus(true)

docs/components_config_SetServerScreen.bs.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@
131131

132132
if key = "OK" and m.serverPicker.hasFocus()
133133
m.top.serverUrl = m.serverPicker.content.getChild(m.serverPicker.itemFocused).baseUrl
134-
m.buttons.callFunc("focus")
134+
m.buttons.setFocus(true)
135135
'if the user pressed the down key and we are already at the last child of server picker, then change focus to the url textbox
136136
else if key = "down" and m.serverPicker.hasFocus() and m.serverPicker.content.getChildCount() > 0 and m.serverPicker.itemFocused = m.serverPicker.content.getChildCount() - 1
137137
m.serverUrlContainer.setFocus(true)
@@ -158,7 +158,7 @@
158158
m.serverUrlContainer.setFocus(true)
159159
'focus the submit button from serverUrl
160160
else if key = "down" and m.serverUrlContainer.hasFocus()
161-
m.buttons.callFunc("focus")
161+
m.buttons.setFocus(true)
162162
else if key = "options"
163163
if m.serverPicker.itemFocused >= 0 and m.serverPicker.itemFocused < m.serverPicker.content.getChildCount()
164164
serverName = m.serverPicker.content.getChild(m.serverPicker.itemFocused).name

docs/components_liveTv_ProgramDetails.bs.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@
255255
if m.top.hasFocus = true
256256
m.overview.maxLines = m.maxDetailLines
257257
m.buttonsFocusAnimationOpacity.keyValue = [0, 1]
258-
m.buttons.callFunc("focus") ' JRButtonGroup handles button focus
258+
m.buttons.setFocus(true)
259259
else
260260
m.top.watchSelectedChannel = false
261261
m.top.recordSelectedChannel = false
@@ -272,7 +272,7 @@
272272
if m.top.hasFocus = false
273273
m.overview.maxLines = m.maxPreviewLines
274274
else if m.top.hasFocus = true
275-
m.buttons.callFunc("focus")
275+
m.buttons.setFocus(true)
276276
end if
277277
end if
278278
end sub

docs/components_login_UserSelect.bs.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@
177177
end if
178178
else if key = "down"
179179
if m.top.focusedChild.isSubType("UserRow")
180-
m.buttons.callFunc("focus")
180+
m.buttons.setFocus(true)
181181
return true
182182
end if
183183
end if

docs/components_movies_MovieDetails.bs.html

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
m.itemDescription = m.top.findNode("itemDescription")
1919

2020
m.buttonGrp = m.top.findNode("buttons")
21-
m.buttonGrp.callFunc("focus")
21+
m.buttonGrp.setFocus(true)
2222
m.top.lastFocus = m.buttonGrp
2323

2424
' Movie logo - positioned in bottom right
@@ -152,7 +152,7 @@
152152
m.buttonGrp.buttonFocused = 0
153153
end if
154154

155-
m.buttonGrp.callFunc("focus")
155+
focusButtonGroupChild()
156156
else
157157
' Resume button already exists, update its tick values (data may have refreshed)
158158
resumeButton.playbackPositionTicks = m.top.itemContent.json.UserData.PlaybackPositionTicks
@@ -189,7 +189,7 @@
189189
else
190190
m.buttonGrp.buttonFocused = 0
191191
end if
192-
m.buttonGrp.callFunc("focus")
192+
focusButtonGroupChild()
193193
end sub
194194

195195
' createInfoLabel: Create a label for the info/director rows
@@ -749,7 +749,7 @@
749749
if focusIndex < 0 then focusIndex = 0
750750
m.buttonGrp.buttonFocused = focusIndex
751751
end if
752-
m.buttonGrp.callFunc("focus")
752+
focusButtonGroupChild()
753753
end if
754754
end sub
755755

@@ -767,6 +767,18 @@
767767
return -1
768768
end function
769769

770+
' focusButtonGroupChild: Focus the button at the current buttonFocused index
771+
' Directly sets focus on the child rather than the group to reliably update
772+
' visuals when focus is already on a sibling child.
773+
'
774+
sub focusButtonGroupChild()
775+
focusIndex = m.buttonGrp.buttonFocused
776+
if not isValid(focusIndex) or focusIndex < 0 or focusIndex >= m.buttonGrp.getChildCount()
777+
return
778+
end if
779+
m.buttonGrp.getChild(focusIndex).setFocus(true)
780+
end sub
781+
770782
' manageDeleteButton: Add or remove Delete button based on server CanDelete permission
771783
' CanDelete is computed server-side and accounts for global, folder-specific, and admin permissions
772784
'
@@ -799,7 +811,7 @@
799811
if focusIndex < 0 then focusIndex = 0
800812
m.buttonGrp.buttonFocused = focusIndex
801813
end if
802-
m.buttonGrp.callFunc("focus")
814+
focusButtonGroupChild()
803815
end if
804816
end sub
805817

@@ -824,7 +836,7 @@
824836
setFieldText("audio_codec", tr("Audio") + ": " + m.top.itemContent.json.mediaStreams[m.top.selectedAudioStreamIndex].displayTitle)
825837
end if
826838

827-
m.buttonGrp.callFunc("focus")
839+
m.buttonGrp.setFocus(true)
828840
end sub
829841

830842
' Check if options were updated and if any reloding is needed...
@@ -850,7 +862,7 @@
850862
m.top.observeField("itemContent", "itemContentChanged")
851863
end if
852864

853-
m.buttonGrp.callFunc("focus")
865+
m.buttonGrp.setFocus(true)
854866
end sub
855867

856868
function onKeyEvent(key as string, press as boolean) as boolean
@@ -888,7 +900,7 @@
888900
m.top.findNode("VertSlider").reverse = true
889901
m.top.findNode("colorSlider").reverse = true
890902
m.top.findNode("pplAnime").control = "start"
891-
m.buttonGrp.callFunc("focus")
903+
m.buttonGrp.setFocus(true)
892904
return true
893905
end if
894906
end if

docs/components_music_AlbumView.bs.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@
131131
m.songList.setFocus(true)
132132
return true
133133
else if key = "left" and m.songList.hasFocus()
134-
m.buttons.callFunc("focus")
134+
m.buttons.setFocus(true)
135135
return true
136136
end if
137137

docs/components_music_ArtistView.bs.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@
6060

6161
if m.sectionScroller.displayedIndex = 0
6262
' User is on the top section with artist info and buttons
63-
m.buttonGrp.callFunc("focus")
63+
m.buttonGrp.setFocus(true)
6464
m.top.lastFocus = m.buttonGrp
6565
else
6666
' User is scrolled down into albums/appearsOn section

docs/components_music_AudioPlayerView.bs.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -783,7 +783,7 @@
783783
' exitScrubMode: Moves player out of scrub mode state, resets back to standard play mode
784784
'
785785
sub exitScrubMode()
786-
m.buttons.callFunc("focus")
786+
m.buttons.setFocus(true)
787787
m.thumb.setFocus(false)
788788

789789
if m.seekPosition.visible

docs/components_music_PlaylistView.bs.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@
143143
m.songList.setFocus(true)
144144
return true
145145
else if key = "left" and m.songList.hasFocus()
146-
m.buttons.callFunc("focus")
146+
m.buttons.setFocus(true)
147147
return true
148148
end if
149149

docs/components_ui_buttongroup_JRButtonGroup.bs.html

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -70,17 +70,6 @@
7070
m.top.translation = [(1920 - buttonsBoundingRect.width) / 2, m.top.translation[1]]
7171
end sub
7272

73-
' Use instead of setFocus(true)
74-
sub focus()
75-
m.top.setFocus(true)
76-
if m.top.buttonFocused <> invalid
77-
button = m.top.getChild(m.top.buttonFocused)
78-
if button <> invalid
79-
button.setFocus(true)
80-
end if
81-
end if
82-
end sub
83-
8473
function onKeyEvent(key as string, press as boolean) as boolean
8574
if not press then return false
8675

0 commit comments

Comments
 (0)