|
18 | 18 | m.itemDescription = m.top.findNode("itemDescription") |
19 | 19 |
|
20 | 20 | m.buttonGrp = m.top.findNode("buttons") |
21 | | - m.buttonGrp.callFunc("focus") |
| 21 | + m.buttonGrp.setFocus(true) |
22 | 22 | m.top.lastFocus = m.buttonGrp |
23 | 23 |
|
24 | 24 | ' Movie logo - positioned in bottom right |
|
152 | 152 | m.buttonGrp.buttonFocused = 0 |
153 | 153 | end if |
154 | 154 |
|
155 | | - m.buttonGrp.callFunc("focus") |
| 155 | + focusButtonGroupChild() |
156 | 156 | else |
157 | 157 | ' Resume button already exists, update its tick values (data may have refreshed) |
158 | 158 | resumeButton.playbackPositionTicks = m.top.itemContent.json.UserData.PlaybackPositionTicks |
|
189 | 189 | else |
190 | 190 | m.buttonGrp.buttonFocused = 0 |
191 | 191 | end if |
192 | | - m.buttonGrp.callFunc("focus") |
| 192 | + focusButtonGroupChild() |
193 | 193 | end sub |
194 | 194 |
|
195 | 195 | ' createInfoLabel: Create a label for the info/director rows |
|
749 | 749 | if focusIndex < 0 then focusIndex = 0 |
750 | 750 | m.buttonGrp.buttonFocused = focusIndex |
751 | 751 | end if |
752 | | - m.buttonGrp.callFunc("focus") |
| 752 | + focusButtonGroupChild() |
753 | 753 | end if |
754 | 754 | end sub |
755 | 755 |
|
|
767 | 767 | return -1 |
768 | 768 | end function |
769 | 769 |
|
| 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 | + |
770 | 782 | ' manageDeleteButton: Add or remove Delete button based on server CanDelete permission |
771 | 783 | ' CanDelete is computed server-side and accounts for global, folder-specific, and admin permissions |
772 | 784 | ' |
|
799 | 811 | if focusIndex < 0 then focusIndex = 0 |
800 | 812 | m.buttonGrp.buttonFocused = focusIndex |
801 | 813 | end if |
802 | | - m.buttonGrp.callFunc("focus") |
| 814 | + focusButtonGroupChild() |
803 | 815 | end if |
804 | 816 | end sub |
805 | 817 |
|
|
824 | 836 | setFieldText("audio_codec", tr("Audio") + ": " + m.top.itemContent.json.mediaStreams[m.top.selectedAudioStreamIndex].displayTitle) |
825 | 837 | end if |
826 | 838 |
|
827 | | - m.buttonGrp.callFunc("focus") |
| 839 | + m.buttonGrp.setFocus(true) |
828 | 840 | end sub |
829 | 841 |
|
830 | 842 | ' Check if options were updated and if any reloding is needed... |
|
850 | 862 | m.top.observeField("itemContent", "itemContentChanged") |
851 | 863 | end if |
852 | 864 |
|
853 | | - m.buttonGrp.callFunc("focus") |
| 865 | + m.buttonGrp.setFocus(true) |
854 | 866 | end sub |
855 | 867 |
|
856 | 868 | function onKeyEvent(key as string, press as boolean) as boolean |
|
888 | 900 | m.top.findNode("VertSlider").reverse = true |
889 | 901 | m.top.findNode("colorSlider").reverse = true |
890 | 902 | m.top.findNode("pplAnime").control = "start" |
891 | | - m.buttonGrp.callFunc("focus") |
| 903 | + m.buttonGrp.setFocus(true) |
892 | 904 | return true |
893 | 905 | end if |
894 | 906 | end if |
|
0 commit comments