Forum Discussion

shadowing's avatar
shadowing
Visitor
15 years ago

Clearing a GridScreen Row

I'm not sure if this was asked before, but is it possible to clear a GridScreen row that is already populated with content? I've tried setting the ContentList with an RoInvalid, or roArray with invalid roAssociativeArrays, but this doesn't seem to work at all.

9 Replies

  • I tried doing that, but that just populates the row with the new content. I'm trying to find a way where I can make the row literally disappear.
  • destruk's avatar
    destruk
    Streaming Star
    ah. ok. Have you tried SetListVisible (integer rowindex, boolean visible) - ie to make row #5 disappear that is screenhandle.SetListVisible(5,False) - with row 0 being the top row. You may need to ensure to set the focusedlistitem to a different row if the user is already on row 5 - I haven't tried making rows disappear and reappear before. Worst case is you destroy the gridscreen and create a new one.
  • destruk's avatar
    destruk
    Streaming Star
    If neither of those options are workable, you 'could' do the removal 'manually' - by setting the bottom row visible=false, then setting the list name for the row you are removing to the name of the row below it. And setting the content of the row you are removing to any content in the row below it. and repeat til all the rows are effectively 'moved up' by one. One of the previous methods in the prior post would be a lot easier.
  • What is SetListVisible supposed to exactly? I've tried using it, but it doesn't really clear the row that I use it on. Instead, the entries are still there, but i can't access it.
  • I've been futzing around a lot more, but the only real solution that I got is kind of hacky. I have to recreate the GridScreen every time I want to 'clear' a row. It seems as if SetListVisible simply keeps the list being shown, but makes it impossible for the user to go to that specific list.
  • destruk's avatar
    destruk
    Streaming Star
    I have been real busy with other projects, so I haven't had any chance to play with this.
    It seems to work fine/as intended. Are you using the Roku1 or Roku2?
  • destruk's avatar
    destruk
    Streaming Star
    code from simplegrid with minor edits


    Function showGridScreen(screen As Object, gridstyle as string) As string
    print "enter showGridScreen"
    categoryList = getCategoryList()
    categoryList[0] = "GridStyle: " + gridstyle
    screen.setupLists(categoryList.count())
    screen.SetListNames(categoryList)
    StyleButtons = getGridControlButtons()
    screen.SetContentList(0, StyleButtons)
    screen.SetContentList(1, getShowsForCategoryItem(categoryList[1]))
    screen.SetContentList(2, getShowsForCategoryItem(categoryList[2]))
    screen.SetContentList(3, getShowsForCategoryItem(categoryList[3]))
    screen.Show()

    'set up flag variable for row visible/invisible
    Flag=TRUE
    'end of edit

    while true
    print "Waiting for message"
    msg = wait(0, m.port)
    print "Got Message:";type(msg)
    if type(msg) = "roGridScreenEvent" then
    print "msg= "; msg.GetMessage() " , index= "; msg.GetIndex(); " data= "; msg.getData()
    if msg.isListItemFocused() then
    print"list item focused | current show = "; msg.GetIndex()
    else if msg.isListItemSelected() then
    row = msg.GetIndex()

    'spliced code
    If row=0
    If Flag=TRUE
    Flag=FALSE
    Print "Reality row visible = FALSE"
    Else
    Flag=TRUE
    Print "Reality row visible = TRUE"
    End If
    screen.SetListVisible(1,Flag) ' toggle visiblility of "Reality row 1"
    End If
    'end of spliced code

    selection = msg.getData()
    print "list item selected row= "; row; " selection= "; selection
    else if msg.isScreenClosed() then
    return ""
    end if
    end If
    end while
    End Function
  • I've been using a Roku 2. I'm not sure if the behavior is different on the Roku 1 though.