Roku Developer Program

Join our online forum to talk to Roku developers and fellow channel creators. Ask questions, share tips with the community, and find helpful resources.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
monkeysource
Visitor

focusPercent not firing for merged cells

Hi,

I'm using a MarkupGrid and for each MarkupGrid XML Component I observe focusPercent to apply an effect as focus is gained on each item. This works great until I merge some cells. For any merged cells the focusPercent is not fired at all.

Say I have 2 columns and 2 rows, and 3 content items. 

I set item 1 to take up to cells as follows:

x=0
y=0
w=1
h=2

And I set Item 2:

x=1
y=0
w=1
h=1

And I set Item 3:


x=1
y=1
w=1
h=1

Now focusPercent will only fire on items 2 and 3. When I set the focus to item 1 I get no focusPercent events for that item at all.  

Any idea why?

Thanks,

Ryan
0 Kudos
6 REPLIES 6
monkeysource
Visitor

Re: focusPercent not firing for merged cells

Hi,

I'm still struggling to find a solution to this one. To me, it seems like a fundamental bug to the grid focus logic. But maybe I'm missing something. Therefore, I have created a sample Channel to highlight the bug which can be found here:

grid-bug-focus-sample

If you run the sample, you'll see it never calls showFocus for cell index 0. I.e. the observer for the focusPercent field is not fired for the item 0 which merges 2 cells. However, it is fired as expected for the other cells. 

This is causing a major stumbling block to using the Grid.

Thanks,

Ryan
0 Kudos
Valeriia
Channel Surfer

Re: focusPercent not firing for merged cells

I have the same problem( I use merging cells for hiding empty ones in the first row. Maybe there is another way to do it? I also tried to set numColumns the number of non-empty elements, but it leads to a cutoff of the poster image. Width change does not produce positive results.
0 Kudos
joetesta
Roku Guru

Re: focusPercent not firing for merged cells

"Valeriia" wrote:
I have the same problem( I use merging cells for hiding empty ones in the first row. Maybe there is another way to do it? I also tried to set numColumns the number of non-empty elements, but it leads to a cutoff of the poster image. Width change does not produce positive results.

for hiding cells I would first try setting the cell to "visible = false" or "opacity = 0"
aspiring
0 Kudos
norcaljohnny
Roku Guru

Re: focusPercent not firing for merged cells

Adjusting the  config.brs and creating a blank cell it now works. (also in main.brs (for i=0 to 3 step 1)

function getGridTemplate() as Object
    if not m.gridTemplate = invalid
        return m.gridTemplate
    end if
    m.gridTemplate = [
        {
            id: 0,
            x: 0,
            y: 0,
            w: 1,
            h: 1
        },
        {
            id: 1,
            x: 1,
            y: 0,
            w: 1,
            h: 1
        },
        {
            id: 2,
            x: 1,
            y: 1,
            w: 1,
            h: 1
        },
        {
            id: 3,
            x: 0,
            y: 1,
            w: 0,
            h: 0
        }
    ]

    return m.gridTemplate
end function

and you can see in the pic all 3  cells are firing

Cheers.
0 Kudos
Valeriia
Channel Surfer

Re: focusPercent not firing for merged cells

"joetesta" wrote:
"Valeriia" wrote:
I have the same problem( I use merging cells for hiding empty ones in the first row. Maybe there is another way to do it? I also tried to set numColumns the number of non-empty elements, but it leads to a cutoff of the poster image. Width change does not produce positive results.

for hiding cells I would first try setting the cell to "visible = false" or "opacity = 0"

I can't do it because of the cell m.MarkupGrid.content.getChild(i) is invalid.
0 Kudos
Valeriia
Channel Surfer

Re: focusPercent not firing for merged cells

"norcaljohnny" wrote:
Adjusting the  config.brs and creating a blank cell it now works. (also in main.brs (for i=0 to 3 step 1)

function getGridTemplate() as Object
    if not m.gridTemplate = invalid
        return m.gridTemplate
    end if
    m.gridTemplate = [
        {
            id: 0,
            x: 0,
            y: 0,
            w: 1,
            h: 1
        },
        {
            id: 1,
            x: 1,
            y: 0,
            w: 1,
            h: 1
        },
        {
            id: 2,
            x: 1,
            y: 1,
            w: 1,
            h: 1
        },
        {
            id: 3,
            x: 0,
            y: 1,
            w: 0,
            h: 0
        }
    ]

    return m.gridTemplate
end function

and you can see in the pic all 3  cells are firing

Cheers.

Thank you!!!
0 Kudos
Need Assistance?
Welcome to the Roku Community! Feel free to search our Community for answers or post your question to get help.

Become a Roku Streaming Expert!

Share your expertise, help fellow streamers, and unlock exclusive rewards as part of the Roku Community. Learn more.