From 83c4146e494c3d22b2fe293e9f961d7092991210 Mon Sep 17 00:00:00 2001 From: Jimi Date: Tue, 22 Oct 2024 21:24:49 -0600 Subject: [PATCH] Don't show extras slider if nothing to show --- components/extras/ExtrasRowList.bs | 21 ++++++++++++++++++--- components/movies/MovieDetails.bs | 2 +- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/components/extras/ExtrasRowList.bs b/components/extras/ExtrasRowList.bs index 70b886c3c..7a0cf1268 100644 --- a/components/extras/ExtrasRowList.bs +++ b/components/extras/ExtrasRowList.bs @@ -35,6 +35,7 @@ sub updateSize() end sub sub loadParts(data as object) + m.extrasGrp = m.top.getParent().findNode("extrasGrp") m.top.parentId = data.id m.people = data.People m.LoadAdditionalPartsTask.itemId = m.top.parentId @@ -42,6 +43,7 @@ sub loadParts(data as object) end sub sub loadPersonVideos(personId) + m.extrasGrp = m.top.getParent().findNode("extrasGrp") m.personId = personId m.LoadMoviesTask.itemId = m.personId m.LoadMoviesTask.observeField("content", "onMoviesLoaded") @@ -114,7 +116,7 @@ sub onLikeThisLoaded() m.SpecialFeaturesTask.control = "RUN" end sub -function onSpecialFeaturesLoaded() +sub onSpecialFeaturesLoaded() data = m.SpecialFeaturesTask.content m.SpecialFeaturesTask.unobserveField("content") if data <> invalid and data.count() > 0 @@ -132,8 +134,8 @@ function onSpecialFeaturesLoaded() addRowSize([462, 372]) end if - return m.top.content -end function + showOrHideMe() +end sub sub onMoviesLoaded() data = m.LoadMoviesTask.content @@ -179,6 +181,8 @@ sub onSeriesLoaded() m.top.content.appendChild(row) end if m.top.visible = true + + showOrHideMe() end sub function buildRow(rowTitle as string, items, imgWdth = 0) @@ -218,6 +222,17 @@ sub addRowSize(newRow) m.top.rowItemSize = newSizeArray end sub +' don't show popup panel if there is nothing to show +sub showOrHideMe() + if isValid(m.top.content) + if m.top.content.getChildCount() = 0 + m.extrasGrp.visible = false + else + m.extrasGrp.visible = true + end if + end if +end sub + sub onRowItemSelected() m.top.selectedItem = m.top.content.getChild(m.top.rowItemSelected[0]).getChild(m.top.rowItemSelected[1]) end sub diff --git a/components/movies/MovieDetails.bs b/components/movies/MovieDetails.bs index 5812f4c47..56ab0ba03 100644 --- a/components/movies/MovieDetails.bs +++ b/components/movies/MovieDetails.bs @@ -403,7 +403,7 @@ function onKeyEvent(key as string, press as boolean) as boolean m.options.setFocus(true) end if - if key = "down" and m.buttonGrp.isInFocusChain() + if key = "down" and m.buttonGrp.isInFocusChain() and m.extrasGrp.visible = true m.top.lastFocus = m.extrasGrid m.extrasGrid.setFocus(true) m.top.findNode("VertSlider").reverse = false